PHP notes from scratch (1)

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

unset($string3) Destroys the specified variable.

(integer)$num rounded to integer

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

is_numeric checks if a variable is a number or a string of numbers

$i = 'only seen 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 it

Locally declared variables do not affect global variables

static $message = 0; set static, $message+=1; the for loop can accumulate (Chapter 3, Lesson 14)

When a local variable wants to call a global variable, add global $hr;

$a = "b"; $b = "I like PHP"; echo $$a."<p>"; output the value of $b through a variable

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

$n = "3.1415926r*r"; $m = 1; $nm = $n.$m; $mn = $n + $m ;

Guess you like

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