Basic PHP Functions
About this set
Created by:
flash4syth on July 9, 2011
Subjects:
Description:
Basic PHP Functions
Classes:
DAD HELL, PHP Concepts and Terms
Log in to favorite or report as inappropriate.
Order by
38 terms
Terms | Definitions |
|---|---|
number_format() | returns a number string in comma format |
trim() | returns a string trimmed of leading and trailing whitespace |
strlen() | returns length of string |
if() | returns true or false |
strcasecmp() | returns 0 if two strings are equal, ignoring case |
printf() | returns formatted string, % is replaced by an item to print |
strtoupper() | makes letters uppercase in a string |
strtolower() | makes letters lowercase in a string |
ucwords() | capitalizes the first letter of each word |
substr() | takes 3 arguments: string, starting position, number of characters to return |
str_replace() | takes 2 arguments: string, replacement string |
abs() | returns absolute value of an argument |
strcmp() | compares 2 strings, returns +#, -#, or 0 based on comparison |
while() | repeating if() |
for() | a loop that takes 3 expressions: initialization, test, and iteration |
array() | used for adding multiple elements to an array as comma delimited 'key => value' lists |
count() | accepts an array, returns number of elements |
foreach($array as $key => $value) | a loop with 3 args: array, $key, $value |
array_key_exists() | accepts 2 args: key, array -> true or false |
in_array() | accepts 2 args: value, array -> true or false. Value is case sensitive for strings. |
unset() | removes an array element |
implode() | 2 args: delimiter, array. prints out elements of an array separated by the delimiter |
explode() | 2 args: delimiter, array. creates an array using the delimiter to distinguish elements |
sort() | sorts an array by element value and reassigns the element keys in order of sorting: zero to last element |
asort() | used for associative arrays, same as sort(), but does not reassign keys |
ksort() | sorts an array by keys |
rsort() | reverse sorting of sort() |
arsort() | inverse of asort() |
krsort() | inverse of ksort() |
array_search() | 2 args: value, array -> key |
dechex() | accepts decimal number -> hexadecimal form |
intval() | number, string, or mixed -> integer with letters discarded |
floatval() | number, string, or mixed -> floating point number with letters discarded |
preg_match() | 2 args: regex, string -> 0 pattern didn't match or 1 pattern matched once |
strip_tags() | removes html tags from a string |
htmlentities() | encodes special html characters of a string |
nl2br() | accepts string -> string with each \n replaced by <br> |
strval() | converts an integer or float into a string |
First Time Here?
Welcome to Quizlet, a fun, free place to study. Try these flashcards, find others to study, or make your own.