php 学习笔记(一)
注释: /* */ // #
heredoc 语法: <<<结束标识
nowdoc 语法: <<<'结束标识'
变量: $var $$vvar
常量: define('PI', 3.14159265358979); echo PI
预定义变量: $_GET, $_POST, $_REQUEST, $GLOBALS, $_SERVER, $_COOKIE, $_FILES, $_ENV, $_SESSION
== 和 ===: 0 == '0' 但 0 !== '0'
逻辑运算: ! && || and or xor
位运算: & | ~ ^ << >>
错误抑制: @ 例如 @(100/0)
类型转换: (int) (double) (string) (array) (object)
执行命令操作: ``(反向单引号)
数组操作: [] => +
其它操作: instanceof ++ --
常用函数:
number_format gettype settype
is_{array|float|int|string|bool|object|resource|null|scalar|numeric|callable}
is_set unset empty
intval floatval strval
fopen fwrite fclose feof fgets fgets fgetcsv fgetc fread
file_exists filesize unlink fseek ftell rewind flock
readfile fpassthru file
file_get_contents file_put_contents
TIPS:
elseif <==> else if
fopen("ftp://$host:$port/$path", "ab", true)