You are on page 1of 8
Arrays " array Intersect LSet rh or array_merge array_pop array_push ‘array_reverse array_walk count in_array Date and Time date mktime strtotime ‘time Filesystem clearstatcache copy feose foets file filemtime filesize file_exists fopen fread frit isd) is_fle readtile Headers header headers_sent setconkle Mail mail Numbers ceil floor number_format round Miscellaneous define eval exit Network fsockopen PHP Options ini_get Ini restore ini_set phpinfo Execution exec A Start of string $ End of string : Any single character (alb) aorb (od) Group section [abe] Item in range (a or b or ¢) [Aabe] Not in range (not a oF b or c) \s White space a Zero of one of 8 at Zero or more of a a One or more of a a3} Exactly Jota a(3,} 3 or more of 3 {3,6} Between 3 and Gof a \ Escape character [:punet:] Any punctuation symbol [:space:] Any space character [iblank:] Space o tab i Case-insensitive s Period matches newline m * and § match lines u Ungreedy matching e Evaluate replacement x Pattern aver several ines array_push ( array, element ) in_array ( needle, haystack ) explode ( separator, string ) split ( patter, string ) breg_split ( pattern, string ) reg ( pattern, string ) strpos ( haystack, needle ) str_replace ( search, replace, string } t Read H Read and write, prepend w Write, truncate wt Read and write, truncate a Wirite, append at Read and write, append ui Y 4 digit year 2005 Y 2 digit year 05 F Long month January M_ Short month Jan m Month (leading zeros) O1 to 12 Month Lito 12 D Short day name Mon | Long day name Monday 4 Day (leading zeros) OL to 31 i Bay Lto 31 h 12-Mour (leading zeros) O1 to 12 9 12:Hour 1to 12 H 24 Hour (leading zeros) 00 to 23 G 24Hour Oto 23 | Minutes (leading zeros) 00 to 59 Seconds (leading zeros) 00 to 59 Ww Day of week * 06 Day af year Oto 365 W Week of year? 1to 53 (Days in month 28 to 31 a am or pm A AM oF PM B Swatch Internet Time 000 to 999 S Ordinal Suffix st nd, td, the T Timezone of machine GMT Z Timezone offset (seconds) 0 Difference to GNT (hours) +0200 1 Daylight savings Lord L Leap year Lord ‘Seconds since Epoch * ¢ 150 8601 (PHP 5) RFC 2822 1, date("w"); 0 is Sunday, 6 is Saturday, 2, Week that overlaps two years belongs to year that contains most days of that week, Hence week number for 1st January ‘of agiven year can return S3rd week if week belongs to previous year. date("W", mktime(0, 0, 0, 12, 28, $year)) ‘always gives correct number of weeks in syear. 3, The Epoch was the Lst January 1970. ‘Regex reg regi ‘ereg_replace ‘eregi_replace split split \preg_match [preg _match_all preg_replace (preg. split ‘Sessions ssession_destroy ‘seasion_ld ‘session_start ‘Strings addsiashes crypt echo explode implode mds nl2br sprintt strip_tags stripslashes strstr ‘strpos strrev strstr srtolower strtoupper str_replace ssubstr trim URLs rawurldecode rawurlencode vuridecode vurlencode Variables empty ‘is_array is int ‘srl ‘numeric ‘s_object ‘isset ‘serialize vunserialize ‘$_SESSION ‘$_SERVER $_ FILES $_REQUEST ‘SGLOBALS Available free fram AddedBytes.com array_diff (arr, arr2 ...) array filter (ar, function) ‘array flip (ae) ‘array_intersect (aerl, arr2 ‘array_merge (arrl, ard ...) arrey_pop (arr) aray_push (arr, var, ward.) ‘erray_reverse (arr) ‘array_search (needle, arr) ‘erray.walk (ar, function) ‘count (count) ‘in_array (needie, haystack) crypt (str, salt) ‘explode (sep, str) implode (glue, arr) alabr (str) sprintf (rt, orgs) sstrip_tags (str, allowed _tags) str_replace (seerch, replace, str) strpos (str, needle) ‘strrew (str) strstr (st, needle) strtolower (str) strtoupper (str) substr (string, start, len) clearstatcache () ‘copy (source, dest) {close (handle) fgets (handle, len) file (file) filerime (fe) filesize (fle) file_exist (ile) fopen (file, mode) fread (handle, len) fwvrite (handle, str) reacfe (fle) Read Read and write, prepend ‘Write, truncate + Read and write, truncate a ‘Write, append at Read and write, append ' 8 w w ‘reg (pattern, str) split (pattem, str) ereg_replace (pattern, replace, str) reg_grep (pattern, arr) preg_match (patten, str) preg_smatch._all (pattern, str, arr) reg_replace (pattern, replace, str) reg_split (patter, str) “ Stam of string End of string : Any single character (alo) aorb (od Group section [abe] Them in range (a, bor ¢) [abe] Not in range (not a, b or ¢) \s White space ” Zeroor one of 8 . Zero or more of a ar Zero-or more of 2, ungreedy at ‘One of more of a we One or more of a, ungreecy le Exactly 3 of a a3} Jor more of a 23,6) Sto 6ota (3,6)? ‘3to 6 of a, ungreedy \ Escape character [:punet:} ‘Any punctuation symbol [:space:] ‘Any space character [iblank:] Space or tab i Case-insensitive 5 Periad matches newine m * and $ match ines u Ungreedy matching e Evaluate replacement * Pattern over several lines SR) date (format, timestamp) smktime (hr, min, sec, month, day, yt) strtotime (str) time () Available free trom ¥ y F ” m a D | q d w-artes wore roeona 4 digit year (2008) 2 digit year (08) Long rnanth (January) ‘Short month (Jan) Month * (01 to 12) ‘Month (1 to 12) ‘Short day name (Mon) Long day name (Monday) Day *(01 to 31) Day (1 to 31) 12 Hour (010 12) 12 Hour (1 ro 12) 24 Hour «(00 to 23) 24 Hour (0 t0 23) Minutes * (00 to $8) ‘Seconds “(00 to $9) Day of week (0 to 6) Day of year (0 to 365) ‘Week of year (1 to 83) ‘Days in month (28 to 31) am or pm AM or PH ‘Swatch Internet Time (000 to 999) ‘Ordinal Suffix (st, nd, th) ‘Timezone of machine (GMT) ‘Timezone offset (seconds) Difference to GMT (hours) (+0200) Daylight saving (1 oF 0) Leap year (1 oF 0) U_ Seconds since Epach * 1S0 8601 (PHP 5) RFC 2822, ‘0 Is Sunday, 6 Is Saturday. . Week that overlaps two years belongs ‘to year that contains most days of that ‘week, Hence week number for 1st January of a given year can be 53 if ‘week belongs to previous year date("W", mitime(0, 0, 0, 12, 8 $year) always gives correct number ‘of weeks in fear }. The Epoch is the Lst January 1970. | With leading zeroes iN AATAN, ATANZ cor RAND usast GREATEST DEGREES: RADIANS TRUNCATE Date and Time DAYOFWEEK WEEKDAY DAYOFMONTH DAYOFYEAR DATE_FORMAT TIME_FORNAT CURRENT_DATE CURRENT_TIME NOW SYSDATE UNIX_TIMESTAMP FROM _UNIXTIME SEC_TO_TIME TIME_TO_SEC HAR String, length 0 « 255 VARCHAR String, length 0 » 255 TINYTEXT String, length 0 - 255 Text String, length 0 - 65535 B08 String, length 0 - 65535 mysqh MEDIUMTEXT String, length 0 - 16777215 ‘mmysql_ermo: MEDIUMBLOB String, length 0 - 16777219 || _mysol_error LONGTEXT — String, length 0 - 4294967295 || mysql_fetch_array LONGBLOB — String, length - 4294967295 |} mysql_fetch_assoe STINYINT Integer, -128 to 127 imysal_fetch field * SMALLINT Integer, -32768 to 32767 rmysal_feteh_lengths * MEDIUMINT: Integer, -8388608 to 8388607 |] mysql_fetch_object *INT Integer, -2147483648 to 2147483647 * BIGINT Int, -9223372036854775008 to 9223372026854775807 FLOAT Decimal (precise to 23 digits) DOUBLE —Decimmal (24 to 53 disits) DECIMAL “DOUBLE” stored as string mysql fleld_type DATE YYYY-NM-DD: mysql_free_result DATETIME YYYY-MH-OD HH:MN:SS imysal_insert_id TIMESTAMP YYYYMMDDHHMNSS mysol_list_dbs TIME HisMb:SS mysql_list_processes ENUM ‘One of preset options mysql_list_tables Set Selection of preset options mysql_num_felds mmysql_num_rows * Note: "UNSIGNED" TINYINT, SMALLINT, mysql_pconnect MEDIUMINT, INT, BIGINT have the same imysql_uery range of values but start at 0, e.g. TINVINT mysql_real_escape_stning UNSIGNED is between 0 and 255, mysal_select_db ‘SUBSTRING MID SUBSTRING_INDEX TRIM RTRIM TRIM SELECT * FROM tablename SELECT column FROM tablename SELECT COUNT(*) FROM tabiename SELECT SUM(column) FROM tableneme ‘SELECT DISTINCT column FROM tabiename SELECT * FROM tablename WHERE condition SELECT * FROM tablename WHERE BINARY condition SELECT * FROM table] INNER JOIN table? on tablel.id = tabie2.id ‘SELECT table1." FROM tablel INNER JOIN table2 on tablel.id = table2.id SELECT LAST_INSERT_ID{) as new_id SELECT max(colurnn) AS alias SELECT * FROM table ORDER BY column ‘SELECT * FROM table LIMIT 10, 20 # Returns all columns # Returns spectic column # Returns number of rows # Retus sum of column # Retums unique values of colurmn # Returns rows that match condition Condition is case-sensitive # Join two tables, return all columns # Only return colurmns from table! # Returns 1D of last created raw # Return maxium value in colurin as “alias” # Return all rows ordering by column 4# Return frst 20 rows after row 10 BIT_COUNT DATABASE USER SYSTEM_USER Available free from www.ILovela janiels.com INET_ATON FOUND_ROWS Version of (XIHTML -chiml> HTML document Page information ‘ Page contents er «l= Comment Text => Page Information - Base URL Meta data - Title Relevant resource