CSS Initial Learning

Source: Internet
Author: User

Code implementation: PHP

Naming conventions:

<?php

Single-line Comment

/*

Multi-line comments

*/


There are actually # and; comments (both Single-line comments), But more for configuration files

?>


Basic syntax for PHP

PHP program writing and and running

Declarations of constants and variables

1+2x=3;

All are constants; x is a variable

Equivalent

$x =1

1+2* $x = 3;


C C + + Java variable description int (model) x=1; String (string Type) x= "abc",

and PHP declaration directly with the $ sign + variable name, such as $x=1;

PHP declaration with $ sign

Constant declaration in PHP $abc= "php" (constant By default all letters are Capitalized)

Declare variable $abc= "zhang san" in PHP (variable default all letters Lowercase)

The variable must be used before the $, declaration and use must have this symbol

Cannot start with a number

You cannot use a system keyword as a variable name with PHP

note: PHP variables are case-sensitive (only variables and constants are case-sensitive, others are Not)

Variable names must be meaningful, you can use English words, you can also use Hanyu Pinyin. AAA BBB CCC

Naming styles for $AAABBBCCC variables

Define ("server", "servers")

<! DOCTYPE html>

<meta http-equiv= "content-type" content= "text/html"; charset= "utf-8" >

<title></title>

<body>

<?php

$sysos =$_server["server_software"]; Gets the string for the server identity

$sysversion =php_version; //get PHP Server version

The following two code connects to MySQL database and obtains MySQL database version information

Mysql_connect ("localhost", "root", "123456");

$mysqlinfo =mysql_get_server_info ();


Get information about the GD library in the server

If (function_exists ("gd_info")) {

$gd =gd_info ();

$gdinfo = $gd ["gd Version"];

}else{

$gdinfo = "unknown";

}



See if FreeType fonts are supported from the GD library

$freetype = $gd ["freetype support"]? " Support ":" does not support ";

Get the remote file from the PHP configuration file

$allowurl =ini_get ("allow_url_fopen")? " Support ":" does not support ";

Get maximum upload limit from PHP configuration file

$max _upload=ini_get ("file_uploads") ini_get ("upload_max_filesize"): "Disabled";

To get the maximum execution time of a script from a PHP configuration file

$max _ex_time=ini_get ("max_execution_time"). " Seconds ";

The following two get server time, mainland China is using the time of the East eight, set the timezone to write tc/gmt-8

Date_default_timezone_get ("etc/gmt-8");

$systemtime =date ("y-m-d h:i:s", time ());

/* *************************************************************   */

/* output The server information obtained above to the client browser as an HTML table */

/* *************************************************************   */

echo "<table align=center cellspacing=0 cellpadding=0>";

echo "<caption>

echo "<tr><td>web server: </td> <td> $sysos </td> </tr>";

echo "<tr><td>php version: </td> <td> $sysversion </td> </tr>";

echo "<tr><td>mysql version </td> <td> $mysqlinfo </td> </tr>";

echo "<tr><td>gd version </td> <td> $gdinfo </td> </tr>";

echo "<tr><td>freetype </td> <td> $freetype </td> </tr>";

echo "<tr><td> remote file get:</td> <td> $allowurl </td> </tr>";

echo "<tr><td> max upload limit: </td> <td> $max _upload </td> </tr>";

echo "<tr><td> max execution time: </td> <td> $max _ex_time</td> </tr>";

echo "<tr><td> server time: </td> <td> $systemtime </td> </tr>";

Echo "</table>";

Echo "the Current operating system is:". Php_os. " <br/>\n\n ";

echo "the Current file name is:". __file__. " <br/> ";

echo "the Current file name is:". __line__. " <br/> ";


For ($i =1; $i <10; $i + +) {

For ($j =1; $j < $i +1; $j + +) {

echo $j. ' x '. $i. ' = '. $i * $j. " \ t ";

}

Echo ' <br/> ';

}

?>

</body>

Expressions for operators

Declaring methods in PHP function get



This article from "12145719" blog, declined reprint!

CSS Initial Learning

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.