11111

if(!isset($string1)) — Check if the variable is set and not NULL

unset($string3) — Destroy the specified variable.

(integer)$num — round to integer

settype($num,'integer') — use settype function to convert type

if(is_numeric($boo)) — check if variable is a number or numeric string

$i = ' will only see to once'; echo "$i"."<p>"; echo "$i"; — output only once

Want to enter the $ number: echo "Yes, the \$boo is a phone number: $boo!";

define ("MESSAGE","I am a PHP programmer",boolean) — define a constant,boolean(set case insensitive)

echo __FILE__(file path) __LINE__(current line number) PHP_VERSION(PHP version) PHP_OS (Current system)

$j = & $i; — Reference assignment, after the following, as long as i changes, j will also change with the change

The locally declared variable does not affect the global variable

static $message = 0; — Set static, $ message+=1; for loops can be accumulated (Chapter 3, Lesson 14)

When local variables want to call global variables, add them— global $hr;

$a = "b"; $b = "I like PHP"; echo $$a ."<

$a = -100; $c = 30; echo ($a % $c); — prints -10, divide 100 by 3, divide 3 to get 90, leaving 10; 

$n = "3.1415926r*r"; $ m = 1; $nm = $n.$m; $mn = $n + $m ; — . is string concatenation, + is addition

$a = 6; echo $a++; echo $a; echo ++$ a echo $a; — Output result: 6 7 7 7 $a++ is input first and then add ++$a is first add and then output

|| is higher than or, or has a higher weight, and there is a default or-based (priority order : && || and or) Chapter 3, Lesson 21

var_dump($value==100) The result is: bool(true) — print information about

variables )?"Conditional operation": "There is no such value"; — Because it is true, the output result is the first conditional operation

function example($num){} example(10); — Value

function go($name = " jack") { echo $name; } $func = "go"; $func("Tom"); — rename

isset($_POST['text']) — check if variable is set and not NULL

strlen("programming Dictionary Network: www.mrbccd.com") — the function returns the length of the string if(strlen($_POST['pwd'])<6) — check the length of the submitted form password

print can only print the value of a simple type variable (such as int, string)  

print_r can print out the value of a variable of complex type (eg array, object) 

printf("There are %u million bicycles in %s.",$str,$number); — output formatted string

$num = rand( ); — random number $num = rand(1,31) range value

$month = date("n"); get native month $today = date("j"); get native date

include "commend.php "; — Statement contains and runs the specified file (4 lessons in Chapter 4)

$name = array("1"=>"Intelligent Robot","2"=>"Digital Camera");

—Array foreach($name as $key=>$value) — Loop (a variable carries out each primary key to take out the content)

break 1; break 3; — Jump out of 1 and 3 loops. (Chapter 4, Lesson 10)

count($arr) — counts the number of cells in an array, or the number of properties in an object

trim — removes whitespace (or other characters) from the beginning and end of a

string ltrim — removes the beginning and end of a string whitespace (or other characters)

rtrim — remove whitespace (or other characters) at the end of a string

addslashes($str); — escape special characters in a string

$b = stripslashes($a); — reverse turn Restore the characters after meaning

$b=addcslashes($a,"Programming Dictionary Network");



substr("string", start, end); intercept the specified length of the string (can take a negative value, the negative value is the reciprocal)

strcmp($str3, $str4) case-sensitive (same returns 0, different returns 1)

strncmp ($str1,$str2,2); Compare the first 2 characters

strcasecmp($str3,$str4) Case insensitive

$_FILES["Uploaded name value"]["name"]; - is The name of the uploaded file (name, type, size, tmp_name, error)

$picture_name=strstr($picture_name , "."); //Intercept the suffix of the uploaded image through the strstr() function

$file_path = "./uploads\\" ; //Define the storage location of the image in the server

window.location.href='index.php'; Javascript new window

move_uploaded_file($_FILES['u_file']['tmp_name'],$file_path.$_FILES['u_file' ]['name']); // Execute file upload Chapter 5, Lesson 14

substr_count($str,"word") — Count the number of occurrences of the string

str_ireplace (the word that needs to be replaced, replace it with,The article that needs to be replaced); replace the original string Example: Query keyword redline Chapter 5 Lesson 24

number_format($number) — format a number with thousands separator Chapter 5 Lesson 19

$str_arr=explode("@",$str); //Use the mark @ to split the string Apply the explode() function to convert the string into an array

print_r($str_arr); //Output the result of string splitting

$array= implode("@",$str_arr); — Convert the value of a one-dimensional array to a string

echo trim($str, "&& &&") — Remove the blank characters (or other characters) at the beginning and end of the string to

verify the ID Standard Length Chapter 5 Lesson 23

https://tool.lu/regex/ The regular tool

preg_grep() function is used to return array entries that match the pattern.

The preg_last_error() function is used to perform a regular expression match.

The preg_match_all() function is used to perform a global regular expression match.

The preg_last_error() function is used to escape regular expression characters.

The preg_replace() function performs a regular expression search and replace.

The preg_replace_callback() function performs a regular expression search and replaces with a callback.

preg_match — perform matching regular expression

str_replace — substring replacement

array reassignment $newarray["third"]=8; 

$str = array ("books"=>array("literature","history","geography") );



each — Returns the current key/value pair in the array and moves the array pointer one step forward Chapter 7, Lesson 7

list($name,$value)=each($_POST) The blog has a detailed explanation

echo implode(" ",$str) ; Output array

echo count($array,COUNT_RECURSIVE); Recursively count the number of array elements    

$array = array_pop ($arr); Output the last element value, there is one less element in the array. Learn
  
7.13

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325068840&siteId=291194637