Abandoned fish--how long does PHP take to get from getting started to giving up? 12

Source: Internet
Author: User

Today's Lesson: PHP 3-Day Foundation Consolidation video Tutorial "Yan 18"

1. Super Global variables

/*$_SESSION$_COOKIE$_FILES$_ENV//server operating system environment variables. such as the operating system; type, Linux, win, MAC, environment variables, etc. $_server//$GLOBALS//The alias of the global variable roster, you can change the amount of arbitrary access to the global variable */print_r ($_ENW);//easily expose the server information, Print_r ($_server) is not generally allowed;//Gets the domain name of the current Web site and the currently accessed script, visitor IP (remote_addr,http_x_forward_for)//print_r ($_files); echo " <br/> "; $a = 3; $b = 4;function T () {print_r ($GLOBALS); $GLOBALS [' a '] = 99;} T (); Echo $a;

2. Constants

echo "<br/>";//constant: Post-declaration value cannot be modified//Declare a constant define (' pi ', 3.14);//The constant name is not added $echo PI, ' <br/> ';//naming specification: Same as variable, just used to all uppercase Features: The post-declaration value cannot be modified or destroyed, can be accessed anywhere on the page/*pi = 3.15;echo pi;define (' pi ', 3.15); unset (pi); */echo "<br/>"; function A () { echo PI;} A (); echo "<br/>";//Detect constant if (defined (' PI ')) {echo "constant exists";} Formally developed generally such if (!defined (' GEI ')) {define (' GEI ', 8846);} echo Gei;echo "<br/>";//dynamic variable name, use variable value to make constant name $chang = ' GEI '; echo $chang; ECHO constant (' GEI '), ' <br/> '; echo constant ($chang), ' <br/> '; echo "<br/>";

3. File Introduction

File contains: The role of code reuse, you can write the common code snippet to the file, when used to introduce the file//include ('./719.php '); $age = 1;function B () {echo ' Hello ';} <?php$age + = 1;? >include ('./719.php ');//equivalent to 719. PHP file Contents replace Bank/*include ('./7192.php ');//include ('./7192.php ');//include ('./7192.php '); */include_once ('./7192.php '); );//_once is only introduced once, does not duplicate references include_once ('./7192.php '); include_once ('./7192.php '); B (); Echo $age; Require_once ('./71922. php ');//Add _once speed slow//require and include the difference, include as far as possible to execute, reported Warning;require direct fatal, script immediately stop execution

4. In-depth explanation of the system

/* life commonly used in 10 binary computers commonly used 2 binary, 8, 16 binary *///10 echo 123;//a top, a top ten, a top hundred echo 3*1 + 10-2 + 100*1;//8, front with 0 for octal Echo 0123;//a top one, a top eight, A 64//16, the front plus 0x represents 16echo 0x123;//a top one, a Top 16. A top 256//2, PHP currently does not support direct representation//A top 1, a top 2, a top 4, a 8......//10 2-in//5 0000 0101//2 55 128+64+32+16+8+4+2+4 11111111//-1 11111111//8 1 in the end to understand the 255 or 1, depending on the program//such as in MySQL. The Internet understands that -1,unsigned Internet is understood to be 255//10 in binary notation 0 1 2 3 4 5 6 7 8 9 a B c D E F echo 0x1c;


This article from "A Big big waste fish" blog, declined reprint!

Abandoned fish--how long does PHP take to get from getting started to giving up? 12

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.