<?php 8 data Types 4 kinds of scalar shaping Boolean type character type two compound types Array (array) object (object) two special types resource (Resource) null (NULL)
Single quote echo ' direct output variable name '
echo ' $a '; Output $ A
Double quote echo "Direct output variable"
echo "$a"; Output $ A variable
One kanji represents three strings
First scenario: Double quotation marks are embedded in single quotes,
Second scenario: Embedding single quotation marks in double quotation marks
The third scenario: using the escape character "\
$str _string1 = ' A Q: "Where did you learn PHP? "‘;
$str _string2 = "B did not hesitate to answer: ' Of course, XXX!" ‘";
$str _string3 = ' A Q: \ ' Can you tell me the URL? \‘‘;
$str _string4 = "B answer: \" Www.xxxx.com\ "";
$a = fopen ("Open File Root", "R");//Open File
$b = fgets ($a);//Read the contents of the file
$c = fclose ($a);//Close file
Use define (constant name, constant value, [case sensitivity])
Define ("MOOS", "xx", true);
Define ("MOOS", "xx"); default constant name is case-sensitive
Echo Moos;
Example
<?php
Define ("PI", 3.14);
$r = 3;
echo "area is:". (pi* $r * $r). " <br/> ";
echo "Perimeter is:". (2*pi* $r). " <br/> ";
?>
Operator
$a = 10;
$b = + + $a; First Gaga: After adding a value of 1, assign to variable B
Echo $b;
echo "<br/>";
$a = 10;
$b = $a ++;//, assign a value of 10 to variable B and add 1 yourself
Echo $b;
echo "<br/>";
$a = 10;
$a + +; The value of variable a increases from 1
echo $a;
Point Connector
echo $a. " + ". $b." =". ($a + $b);//
PHP Note 1