PHP Cheatsheet
PHP Cheatsheet
EU
Mysql functions
mysql_connect($link, $usr, $pwd) mysql_close() mysql_select_db($db) mysql_db_query($db, $query) mysql_list_dbs() mysql_drop_db($dbName) mysql_list_tables($database) mysql_tablename(resource, $int) mysql_query($query) mysql_num_fields(resource) mysql_num_rows(resource) mysql_fetch_array(resource) mysql_fetch_assoc(resource) mysql_fetch_row(resource) mysql_real_escape_string($str) mysql_error()
String functions
substr_replace($str, search, pos) strstr($haystack, $needle) strlen($str) strpos($haystack, $needle) strip_tags($str) htmlentities($str) htmlspecialchars($str) trim($str) also: rtrim/ltrim implode($glue, arr $pieces) addslashes($str) nl2br($str) crypt($str, [$salt])
Array functions
is_array($var) array_keys(array) array_combine(arr_keys, arr_val) array_diff(arr1, arr2, arr3 ..) array_merge(arr1, arr2, ..) array_push(array, $var) array_reverse(array) array_shift(array) array_walk(array, funcName)
PostgreSQL Functions
pg_connect($conn) pg_connection_reset($conn) pg_pconnect($conn) pg_close([$conn]) pg_fetch_all(resource) pg_fetch_all_columns(resource) pg_fetch_array(resource) pg_fetch_assoc(resource) pg_fetch_object(resource) pg_fetch_row(resource) pg_select($conn, $table, $arr) * pg_insert($conn, $table, $arr) * pg_query([$conn], $query) pg_cancel_query($conn) pg_affected_rows(resource) pg_num_fields(resource) pg_num_rows(resource) pg_ping([$conn]) pg_field_type(resource, $fieldNr) pg_result_error(resource)
Output control
Filesystem functions
fopen($filename, mode) fclose($handler) fread($handler, $len) fwrite($handler, $str) file_exists($filename) file_get_contents($filename) filetype($filename) filesize($filename) is_executable($filename) is_dir($filename) chmod($file, mode) copy($source, $dest) dirname($path)
SQLitet3 Functions
SQLite3::changes() SQLite3::close() SQLite3::_construct($filename) SQLite3::escapeString($val) SQLite3::exec($query) SQLite3::lastErrorCode() SQLite3::lastErrorMsg() SQLite3::lastInsertRowID() SQLite3::loadExtension($lib) SQLite3::open($filename) SQLite3::prepare($query) SQLite3::query($query) SQLite3::querySingle($query)
Function handling
func_get_arg($arg_num) func_get_args() func_num_args() function_exists($funcName) get_defined_functions()
* the current function is experimental at the time of this writting. [ ] detonates optional parameters.