php& MySQL (ii)--sleepy also have to gnaw book, PHP tutorial _php Tutorial

Source: Internet
Author: User

Php&mysql (ii)--sleepy also have to chew Book, PHP tutorial


Madan, all things are going to get together ... After noon every day to learn cars ah, good fun. Good evening, but sleepy also have to chew book ...

Second, PHP script programming language

What variable ah, data type Ah, especially special basic not recorded, say point easy to ignore.

 PhpDefine("PI", 3.1415926);//Definition of ConstantsEcho"PI =".PI."
";//. The link function, also used for the assignment of $var, etc.if(PI<3&&PI>=2) { $var=;}Else{ Echo"F**k". " ";}//First Judge Pi<3, if not set up, directly into the else--called short-circuit design, speed up the program;//Similarly, in order to achieve efficient program, put the most error-prone front, the most complex calculation put on the right$var= "Asldkjflajdfklj";$v 2=(Boolean)$var;//Forcing type conversionsEcho $v 2;Echo"
";$v _true=true;//A Boolean value can also be directly assigned to a valueif(Is_bool($v 2) &&$v 2===$v _true) {//identity = = =, you can determine whether the data type is the same; Is_bool Echo"Variables has the same value and type!"; Echo" ";}//In addition, the non-identity is still!==$lll= "DFA" +333;Var_dump($lll);Echo" ";Print_r($lll);Echo" ";Echo GetType($lll);Echo" ";//Var_dump allows multiple variables to be checked at once while providing information, and print_r is used to output arrays and objects;if(isset($lll) &&!Empty($v 2)) {//determines whether the empty unset($lll);}Var_dump($lll);Echo" ";//will error, but can still output nullfunctionDoubleint ($var){//Custom Functions if(Is_int($var)) { $var=$var* *; return $var; }Else{ Echo"Please enter a int data."; }}EchoDoubleint ($var);Echo" ";EchoDoubleint (4);Echo" ";//personally think, or less with global and address delivery, logically error-prone, the program is correct, the result is not//about the Include and require//multi-use include bar//include failure is just a warning, the latter is a mistake and then interrupt the program// Also recommended to write absolute path, good reading is not easy to make mistakes

To say is all above, summed up is: constants, connectors, custom functions, type conversions, type judgments, file references, identity characters, short-circuit design, var_dump.

More chaotic.

Finally, for example, a self-made multiplication table.

 
  PHP//Chapter 2 ' s example which is a Chengfabiaofunction chengfabiao ($var) {      for ($row= 1; $row<=$var; $row+ +)        {for ($queue=1;  $queue<=$var; $queue+ +)            {$answer=$row*$queue;             Echo "$row*$queue=". $answer. "  " ;        }         Echo "
 
  ";    }        } $var=9; Chengfabiao ($var);


Change yourself to play. Basic things have to be often taken out of the review, I think so.

http://www.bkjia.com/PHPjc/1105146.html www.bkjia.com true http://www.bkjia.com/PHPjc/1105146.html techarticle Phpmysql (ii)--sleepy also have to chew Book, PHP tutorial Madan, all things dare to get together ... After noon every day to learn cars ah, good fun. Good evening, but sleepy also have to chew book ...

  • 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.