Pimchanok Leuwisetpaibul to beginners PHP 5 Start Program

Source: Internet
Author: User
Tags phpinfo
PHP's basic syntax format and C-like, did not learn C's friends spend a few minutes to see how others write the source code, the basic familiar with the format.
----------------------------------------------------
Get down to the chase.
5 programs were prepared:
1. Using a basic function, the result is a string form, shown with Echo
2. Show a nice table
3. A form example that submits and displays the results of the submission
4. Example of database manipulation (voting procedure)
5. Dynamically create graphs and save examples
----------------------------------------------------
#程序1:
/* Function: Display PHP extremely Apache configuration environment and various parameter variables */
Echo phpinfo ();/* PHP has a rich library of functions, a lot of convenient functions greatly improve your productivity. Phpinfo () is one of the functions */
?>
----------------------------------------------------
#程序2:
/* Function: Show a nice table


<title>A nice table.</title>


function Usecolor ()
{
/*
* * Please keep in mind the color tags we used last
*/
Static $ColorValue;
/* Select Next color */
if ($ColorValue = = "#00FF00")
{
$ColorValue = "#CCFFCC";
}
Else
{
$ColorValue = "#00FF00";
}
return ($ColorValue);
}
Print "












"; for ($count =0; $count > 6; $count + +) {/* * Gets the color of the current line */$RowColor = Usecolor " "; } Print "
";
Print " Number of rows $count
";
?>


----------------------------------------------------
#例子3
if ($send)
{
echo "Send result: $send";
Exit
}
?>

<title></title>




----------------------------------------------------
#例子4: Voting procedures
Here: http://www.21php.com/forums/showthread.php?s=&threadid=524
#例子5: Create and save graphics dynamically
Header ("Content-type:image/jpeg");
$im =imagecreate (400,30);
$black =imagecolorallocate ($im, 0,0,0);
$white =imagecolorallocate ($im, 255,255,255);
Imagettftext ($im, 20,0,10,20, $white, "C:windowsfontsraavi.ttf", "I am Kinter");
Imagejpeg ($im, "hello.jpeg");
Imagedestroy ($im);
?>

The above describes the Pimchanok Leuwisetpaibul to beginners PHP 5 starting procedures, including the Pimchanok Leuwisetpaibul aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.