This note only extracts the parts of PHP that need to be noticed, about operators, simple judgments, and so on.
1 string
1.1 strlen () function to calculate the length of a string
1.2 strops () function to retrieve strings or characters within a string
2 arrays
2.1 Array of numeric IDs with numeric ID keys
Auto-Assign ID key:
$names = Array ("A", "B", "C"); Manually assign ID key:
$names [0] = "a"; $names [1] = "B"; $names [2] = "C"; Use the ID key:
2.2 Each ID key in an associative array array is associated with a value
To assign a value as a key:
$ages = Array ("A" =>10, "B" =>20, "C" =>30), another method:
$ages ["a"] = "ten", $ages ["b"] = "a", $ages ["c"] = "30"; Use the ID key:
2.3 A multi-dimensional array containing an array of one or more arrays (slightly)
3 Cycles
3.1 While
"$i + +;}?" >
3.2 Do...while
";} while ($i <5);? >
3.3 for
";}? >
3.4 foreach
The foreach statement is used to iterate through an array, and each time a loop is made, the value of the current array element is assigned to the value variable (the array pointer is moved one after the other) and so on.
Grammar
foreach (array as value) {//...} Example: outputting the value of a given array
";}? >
4 functions
4.1 Passing parameters
";} echo "My name is"; Writename ("Gang", "Li"); echo "My Name is" Writename ("San", "Zhang"); >
4.2 Return value
5 form Processing
The $_get variable is used to collect the value of a form from method= "get".
The $_post variable is used to collect the value of the form from the method= "post".
5.1 $_get Variable
form.php
welcome.php
Welcome .
You are years old!
5.2 $_post Variable
What is different from $_get is that:
$_post does not send information limits, while $_get limits 100 characters
$_post does not reflect the value in the form at the URL, and the URL passed by $_get can be added to the Favorites folder
5.3 $_request Variable
The $_request variable can be used to obtain results sent to form data via the Get and post methods
http://www.bkjia.com/PHPjc/478822.html www.bkjia.com true http://www.bkjia.com/PHPjc/478822.html techarticle This note only extracts the parts of PHP that need to be noticed, about operators, simple judgments, and so on. 1 String 1.1 strlen () function calculates the string length? Phpecho strlen ("Hello world ...