Php Strings

¡Supera tus tareas y exámenes ahora con Quizwiz!

A type specifiers 1) % - ?? 2) b - ?? 3) c - ?? 4) d - ?? 5) e - ?? since PHP 5.2.1. In earlier versions, it was taken as number of significant digits (one less). 6) E - ?? 7) u - ?? 8) f - ?? (locale aware). 9) F - ?? (non-locale aware). 10) g - ?? 11) G - ?? 12) o - ?? 14) s - ?? 15) x - ?? 16) X - ??

A type specifiers 1) ?? - a literal percent character. No argument is required. 2) ?? - the argument is treated as an integer, and presented as a binary number. 3) ?? - the argument is treated as an integer, and presented as the character with that ASCII value. 4) ?? - the argument is treated as an integer, and presented as a (signed) decimal number. 5) ?? - the argument is treated as scientific notation (e.g. 1.2e+2). PHP 5.2.1. 6) ?? - like %e but uses uppercase letter (e.g. 1.2E+2). 7) ?? - the argument is treated as an integer, and presented as an unsigned decimal number. 8) ?? - the argument is treated as a float, and presented as a floating-point number (locale aware). 8) ?? - the argument is treated as a float, and presented as a floating-point number (non-locale aware) 9) ?? - shorter of %e and %f. 10) ?? - shorter of %E and %f. 11) ?? - the argument is treated as an integer, and presented as an octal number. 12) ?? - the argument is treated as and presented as a string. 13) ?? - the argument is treated as an integer and presented as a hexadecimal number (with lowercase letters). 14) ?? - the argument is treated as an integer and presented as a hexadecimal number (with uppercase letters).

strchr()

Alias of strstr()

int strcasecmp ( string $str1 , string $str2 )

Binary safe case-insensitive string comparison Returns < 0(negative) if str1 is less than str2; > 0(positive) if str1 is greater than str2, and 0 if they are equal.

int substr_compare ( string $main_str , string $str , int $offset [, int $length [, bool $case_insensitivity = false ]] )

Binary safe comparison of two strings from an offset, up to length characters Returns < 0 if main_str from position offset is less than str, > 0 if it is greater than str, and 0 if they are equal. If offset is equal to or greater than the length of main_str or length is set and is less than 1, substr_compare() prints a warning and returns FALSE.

int strcmp ( string $str1 , string $str2 )

Binary safe string comparison(case sensitive)

int similar_text ( string $first , string $second [, float &$percent ] )

Calculate the similarity between two strings. Returns the number of characters that match ex. func('ryan','ryam') returns 3 By passing a reference as third argument, similar_text() will calculate the similarity in percent for you. $word1 = "ryan"; $word2 = "nayr"; $match = similar_text($word1, $word2); this seems to return 1 for some reason with 25% similarity

string soundex ( string $str )

Calculate the soundex key of a string seems to be more accurate than metaphone

string metaphone ( string $str [, int $phonemes = 0 ] )

Calculates the metaphone key of str. Similar to soundex() metaphone creates the same key for similar sounding words. It's more accurate than soundex() as it knows the basic rules of English pronunciation. The metaphone generated keys are of variable length. phonemes - This parameter restricts the returned metaphone key to phonemes characters in length. The default value of 0 means no restriction. Metaphone was developed by Lawrence Philips <lphilips at verity dot com>. It is described in ["Practical Algorithms for Programmers", Binstock & Rex, Addison Wesley, 1995].

string sha1_file ( string $filename [, bool $raw_output = false ] )

Calculates the sha1 hash of the file specified by filename using the » US Secure Hash Algorithm 1, and returns that hash. The hash is a 40-character hexadecimal number. raw_output - When TRUE, returns the digest in raw binary format with a length of 20. When TRUE, returns the digest in raw binary format with a length of 20.

int strnatcasecmp ( string $str1 , string $str2 )

Case insensitive string comparisons using a "natural order" algorithm This function implements a comparison algorithm that orders alphanumeric strings in the way a human being would. The behaviour of this function is similar to strnatcmp(), except that the comparison is not case sensitive. Similar to other string comparison functions, this one returns < 0 if str1 is less than str2 > 0 if str1 is greater than str2, and 0 if they are equal. $a = "1"; $a2 = "01"; //following is true with natural comparison strnatcasecmp($a, $a2);

mixed str_ireplace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] )

Case-insensitive version of str_replace().

string html_entity_decode ( string $string [, int $quote_style = ENT_COMPAT [, string $charset ]] )

Convert all HTML entities to their applicable characters ENT_COMPAT - Will convert double-quotes and leave single-quotes alone. ENT_QUOTES - Will convert both double and single quotes. ENT_NOQUOTES - Will leave both double and single quotes unconverted.

string bin2hex ( string $str )

Convert binary data(A STRING) into hexadecimal representation It takes the ascii representation of the string and converts it into HEX for ex. "23" becomes "3233" acii value of 2 =50 ascii value of 3 = 51 the hex of 50 = 32 the hex of 51 = 33 Returns an ASCII string containing the hexadecimal representation of str. The conversion is done byte-wise with the high-nibble first.

mixed str_word_count ( string $string [, int $format = 0 [, string $charlist ]] )

Counts the number of words inside string. If the optional format is not specified, then the return value will be an integer representing the number of words found. In the event the format is specified, the return value will be an array, content of which is dependent on the format. The possible value for the format and the resultant outputs are listed below. For the purpose of this function, 'word' is defined as a locale dependent string containing alphabetic characters, which also may contain, but not start with " ' "(comma) and "-"(hyphen) characters. Format * 0 - returns the number of words found * 1 - returns an array containing all the words found inside the string * 2 - returns an associative array, where the key is the numeric position(where it starts) of the word inside the string and the value is the actual word itself charlist - A list of additional characters which will be considered as 'word'

string convert_uudecode ( string $data )

Decode a uuencoded string Uuencoding is a form of binary-to-text encoding that originated in the Unix program uuencode, for encoding binary data for transmission over the uucp mail system. It has now been largely replaced by MIME and yEnc. With MIME, files that might have been uuencoded are transferred with base64 encoding.

int stripos ( string $haystack , string $needle [, int $offset = 0 ] )

Find position of first occurrence of a case-insensitive string Returns the numeric position of the first occurrence of needle in the haystack string. If needle is not found, stripos() will return boolean FALSE. offset -The optional offset parameter allows you to specify which character in haystack to start searching. The position returned is still relative to the beginning of haystack. $txt = "ryan,king"; $txt2 = "nayr"; print stripos("Ryan is king", "is"); //returns 5

int strripos ( string $haystack , string $needle [, int $offset = 0 ] )

Find position of last occurrence of a case-insensitive string in a string. Unlike strrpos(), it is case-insensitive. The offset parameter may be specified to begin searching an arbitrary number of characters into the string. Negative offset values will start the search at offset characters from the start of the string.

int strspn ( string $subject , string $mask [, int $start [, int $length ]] )

Find the length of consecutive characters in the string which can be made using characters in the second arguments. If start and length are omitted, then all of subject will be examined. If they are included, then the effect will be the same as calling strspn(substr($subject, $start, $length), $mask) (see substr for more information). Finds the length of the first segment of a string consisting entirely of characters contained within a given mask. strspn("ryan","zyar"); //returns 3 strspn("abcdefg","dce"); //returns 0, starting position must match strspn("abcdefg","dce",2); //returns 3 print strspn("abcdefg","ac",0,2); //returns 1

string number_format ( float $number , int $decimals = 0 [ , string $dec_point = '.' , string $thousands_sep = ','] )

Format a number, specify the number of decimals, the thousand character and the decimal point character This function accepts either one, two, or four parameters (not three): NUMBER IS ROUNDED

string strtr ( string $str , string $from , string $to ) string strtr ( string $str , array $replace_pairs )

If given three arguments, this function returns a copy of str where all occurrences of each (single-byte) character in "from" have been translated to the corresponding character in "to"(FUNCTION IS CASE SENSITIVE) strtr('this', "si", "ta"); / / outputs that If from and to have different lengths, the extra charcters in the longer of the two are ignored. The length of str will be the same as the return value's. $arr = array("Hello" => "Hi", "world" => "earth"); echo strtr("Hello world",$arr); //hi earth The longest keys will be tried first. Once a substring has been replaced, its new value will not be searched again. $arr = array("Hi"=>"cool","Hello" => "Hi", "world" => "earth"); echo strtr("Hello world",$arr); //hi earth In this case, the keys and the values may have any length, provided that there is no empty key; additionaly, the length of the return value may differ from that of str. However, this function will be the most efficient when all the keys have the same size.

string nl2br ( string $string [, bool $is_xhtml = true ] )

Inserts HTML line breaks before all newlines in a string

string implode ( string $glue , array $pieces )

Join array elements with a glue(string) string

int strcoll ( string $str1 , string $str2 )

Locale based string comparison Note that this comparison is case sensitive, and unlike strcmp() this function is not binary safe. uses the current locale for doing the comparisons. If the current locale is C or POSIX, this function is equivalent to strcmp().

int vfprintf ( resource $handle , string $format , array $args )

Operates as fprintf() but accepts an array of arguments, rather than a variable number of arguments.

int vprintf ( string $format , array $args )

Operates as printf() but accepts an array of arguments, rather than a variable number of arguments.

string vsprintf ( string $format , array $args )

Operates as sprintf() but accepts an array of arguments, rather than a variable number of arguments.

array str_getcsv ( string $input [, string $delimiter = ',' [, string $enclosure = '"' [, string $escape = '\\' ]]] )

Parse a CSV string into an array Similar to fgetcsv() this functions parses a string as its input unlike fgetcsv() which takes a file as its input.

void parse_str ( string $str [, array &$arr ] )

Parses str as if it were the query string passed via a URL and sets variables in the current scope. should be in the format of 'name=ex&age=10' If the second parameter arr is present, variables are stored in this variable as array elements instead. returns: NO VALUE IS RETURNED Note: The magic_quotes_gpc setting affects the output of this function, as parse_str() uses the same mechanism that PHP uses to populate the $_GET, $_POST, etc. variables.

string str_rot13 ( string $str )

Performs the ROT13 encoding on the str argument and returns the resulting string. The ROT13 encoding simply shifts every letter by 13 places in the alphabet while leaving non-alpha characters untouched. Encoding and decoding are done by the same function, passing an encoded string as argument will return the original version.

string str_shuffle ( string $str )

Randomly shuffles a string

mixed str_replace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] )

Replace all occurrences of the search string with the replacement string case sensitive version of str_ireplace

mixed substr_replace ( mixed $string , string $replacement , int $start [, int $length ] )

Replace text within a portion of a string replaces a copy of string delimited by the start and (optionally) length parameters with the string given in replacement. The result string is returned. If string is an array then array is returned.

string sprintf ( string $format [, mixed $args [, mixed $... ]] )

Returns a string produced according to the formatting string format. similar to printf but returns the results instead

string addcslashes ( string $str , string $charlist )

Returns a string with backslashes before characters that are listed in charlist parameter. A list of characters to be escaped. If charlist contains characters \n, \r etc., they are converted in C-like style, while other non-alphanumeric characters with ASCII codes lower than 32 and higher than 126 converted to octal representation. you can you ranges ex. 'A..z' echo addcslashes('foo[ ]', 'A..z'); Be careful if you choose to escape characters 0, a, b, f, n, r, t and v. They will be converted to \0, \a, \b, \f, \n, \r, \t and \v. In PHP \0 (NULL), \r (carriage return), \n (newline), \f (form feed), \v (vertical tab) and \t (tab) are predefined escape sequences, while in C all of these are predefined escape sequences. charlist like "\0..\37", which would escape all characters with ASCII code between 0 and 31.

string addslashes ( string $str )

Returns a string with backslashes before characters that need to be quoted in database queries etc. These characters are single quote ('), double quote ("), backslash (\) and NUL (the NULL byte). it's highly recommended to use DBMS specific escape function (e.g. mysqli_real_escape_string() for MySQL or pg_escape_string() for PostgreSQL)

string ucfirst ( string $str )

Returns a string with the first character of str capitalized, if that character is alphabetic. Note that 'alphabetic' is determined by the current locale. For instance, in the default "C" locale characters such as umlaut-a (ä) will not be converted.

array explode ( string $delimiter , string $string [, int $limit ] )

Returns an array of strings, each of which is a substring of string formed by splitting it on boundaries formed by the string delimiter.

string str_repeat ( string $input , int $multiplier )

Returns input repeated x amount of times. x is the second argument

string strtolower ( string $str )

Returns string with all alphabetic characters converted to lowercase. Note that 'alphabetic' is determined by the current locale. This means that in i.e. the default "C" locale, characters such as umlaut-A (Ä) will not be converted.

string strtoupper ( string $string )

Returns string with all alphabetic characters converted to uppercase. Note that 'alphabetic' is determined by the current locale. For instance, in the default "C" locale characters such as umlaut-a (ä) will not be converted.

string strrev ( string $string )

Returns string, reversed.

int ord ( string $string )

Returns the ASCII value of the first character of string.

int strlen ( string $string )

Returns the length of the given string. use mb_strlen for unicode/multibyte characters

int strcspn ( string $str1 , string $str2 [, int $start [, int $length ]] )

Returns the length of the initial segment of str1 which does not contain any of the characters in str2. Returns the length of the segment as an integer. ex. print strcspn("ryan is king", "na"); //returns 2 print strcspn("ryan is king", "n"); //returns 3 print strcspn("ryan is king", "nr"); //returns 0 print strcspn("ryan is king", "nr",1); //returns 2 print strcspn("ryan is king", "nr",3); //returns 0

int strpos ( string $haystack , mixed $needle [, int $offset = 0 ] )

Returns the numeric position of the first occurrence of needle in the haystack string. Unlike the strrpos() before PHP 5, this function can take a full string as the needle parameter and the entire string will be used. Find position of first occurrence of a string offset - The optional offset parameter allows you to specify which character in haystack to start searching. The position returned is still relative to the beginning of haystack.

int strrpos ( string $haystack , string $needle [, int $offset = 0 ] )

Returns the numeric position of the last occurrence of needle in the haystack string. Find the position of the last occurrence of a substring in a string Returns the position where the needle exists. Returns FALSE if the needle was not found. offset May be specified to begin searching an arbitrary number of characters into the string. Negative values will stop searching at an arbitrary point prior to the end of the string.

string substr ( string $string , int $start [, int $length ] )

Returns the portion of string specified by the start and length parameters.

string strstr ( string $haystack , mixed $needle [, bool $before_needle = false ] )

Returns the substring starting from the index of the match. Returns starting at the first match that is encountered func("ryan is the king","the") return "the king" before_neeedle is only in php 5

array get_html_translation_table ([ int $table = HTML_SPECIALCHARS [, int $quote_style = ENT_COMPAT ]] )

Returns the translation table used by htmlspecialchars() and htmlentities() returns: an array Index is the string and value is the encoded value There are two new constants (HTML_ENTITIES, HTML_SPECIALCHARS) that allow you to specify the table you want.

string chunk_split ( string $body [, int $chunklen = 76 [, string $end = "\r\n" ]] )

Split a string into smaller chunks returns: A string $chunk = "ryanwright"; print func($chunk,2,"."); //ouputs ry.an.wr.ig.ht. string -Required. Specifies the string to split length - Optional. A number that defines the length of the chunks. Default is 76 end - Optional. A string that defines what to place at the end of each chunk. Default is \r\n

string trim ( string $str [, string $charlist ] )

Strip whitespace (or other characters) from the beginning and end of a string This function returns a string with whitespace stripped from the beginning and end of str. Without the second parameter, trim() will strip these characters: * " " (ASCII 32 (0x20)), an ordinary space. * "\t" (ASCII 9 (0x09)), a tab. * "\n" (ASCII 10 (0x0A)), a new line (line feed). * "\r" (ASCII 13 (0x0D)), a carriage return. * "\0" (ASCII 0 (0x00)), the NUL-byte. * "\x0B" (ASCII 11 (0x0B)), a vertical tab.

int levenshtein ( string $str1 , string $str2 [ , int $cost_ins , int $cost_rep , int $cost_del ] )

The Levenshtein distance is defined as the minimal number of characters you have to replace, insert or delete to transform str1 into str2 It can be used only for strings with less than 255 characters

string htmlspecialchars ( string $string [, int $flags = ENT_COMPAT [, string $charset [, bool $double_encode = true ]]] )

This function encodes & ' < > " to there equivalent html entities. ' is not encoded by default the ENT_QUOTES flat needs to be set 5.2.3 When double_encode is false off PHP will not encode existing html entities, the default is to convert everything. This function is useful in preventing user-supplied text from containing HTML markup, such as in a message board or guest book application. The translations performed are: * '&' (ampersand) becomes '&amp;' * '"' (double quote) becomes '&quot;' when ENT_NOQUOTES is not set. * ''' (single quote) becomes '&#039;' only when ENT_QUOTES is set. * '<' (less than) becomes '&lt;' * '>' (greater than) becomes '&gt;'

int strnatcmp ( string $str1 , string $str2 )

This function implements a comparison algorithm that orders alphanumeric strings in the way a human being would, this is described as a "natural ordering". Note that this comparison is case sensitive. String comparisons using a "natural order" algorithm Similar to other string comparison functions, this one returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.

join()

This function is an alias of: implode().

chop()

This function is an alias of: rtrim().

string htmlentities ( string $string [, int $flags = ENT_COMPAT [, string $charset [, bool $double_encode = true ]]] )

This function is identical to htmlspecialchars() in all ways, except all characters which have HTML character entity equivalents are translated into these entities. ' is not encoded by default. ENT_COMPAT Will convert double-quotes and leave single-quotes alone. ENT_QUOTES Will convert both double and single quotes. ENT_NOQUOTES Will leave both double and single quotes unconverted. ENT_IGNORE Silently discard invalid code unit sequences instead of returning an empty string. Added in PHP 5.3.0. This is provided for backwards compatibility; avoid using it as it may have security implications.

int strncasecmp ( string $str1 , string $str2 , int $len )

This function is similar to strcasecmp(), with the difference that you can specify the (upper limit of the) number of characters from each string to be used in the comparison. Binary safe case-insensitive string comparison of the first n characters Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.

int strncmp ( string $str1 , string $str2 , int $len )

This function is similar to strcmp(), with the difference that you can specify the (upper limit of the) number of characters from each string to be used in the comparison. len - Number of characters to use in the comparison. Note that this comparison is case sensitive. Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.

string htmlspecialchars_decode ( string $string [, int $quote_style = ENT_COMPAT ] )

This function is the opposite of htmlspecialchars(). It converts special HTML entities back to characters. The converted entities are: &amp;, &quot; (when ENT_NOQUOTES is not set), &#039; (when ENT_QUOTES is set), &lt; and &gt;. ENT_COMPAT Will convert double-quotes and leave single-quotes alone (default) ENT_QUOTES Will convert both double and single quotes ENT_NOQUOTES Will leave both double and single quotes unconverted

string strrchr ( string $haystack , mixed $needle )

This function returns the portion of haystack which starts at the last occurrence of needle and goes until the end of haystack. Find the last occurrence of a character in a string

string strip_tags ( string $str [, string $allowable_tags ] )

This function tries to return a string with all NUL bytes, HTML and PHP tags stripped from a given str. It uses the same tag stripping state machine as the fgetss() function. ex. '<p><a>'

string str_pad ( string $input , int $pad_length [, string $pad_string = " " [, int $pad_type = STR_PAD_RIGHT ]] )

This functions returns the input string padded on the left, the right, or both sides to the specified padding length. If the optional argument pad_string is not supplied, the input is padded with spaces, otherwise it is padded with characters from pad_string up to the limit. Optional argument pad_type can be STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH. If pad_type is not specified it is assumed to be STR_PAD_RIGHT.

string stripcslashes ( string $str )

Un-quote string quoted with addcslashes()

string stripslashes ( string $str )

Un-quotes a string quoted. ex a string that was quoted with addslashes

string ucwords ( string $str )

Uppercase the first character of each word in a string

string convert_uudecode ( string $data )

Uuencode a string Uuencoding is a form of binary-to-text encoding that originated in the Unix program uuencode, for encoding binary data for transmission over the uucp mail system. It has now been largely replaced by MIME and yEnc. With MIME, files that might have been uuencoded are transferred with base64 encoding.

string wordwrap ( string $str [, int $width = 75 [, string $break = "\n" [, bool $cut = false ]]] )

Wraps a string to a given number of characters using a string break character.

string stristr ( string $haystack , mixed $needle [, bool $before_needle = false ] )

case insensitive version of strstr()

int crc32 ( string $str )

generate the checksum of a string crc32. similar to md5

mixed sscanf ( string $str , string $format [, mixed &$... ] )

it is the input analog of printf(). it reads from the string str and interprets it according to the specified format, which is described in the documentation for sprintf(). This function basically does the reverse Any whitespace in the format string matches any whitespace in the input string. This means that even a tab \t in the format string can match a single space character in the input string. --Optionally pass in variables by reference that will contain the parsed values. * Function is not locale-aware. * F, g, G and b are not supported. * D stands for decimal number. * i stands for integer with base detection. * n stands for number of characters processed so far.

string lcfirst ( string $str )

lcfirst — Make a string's first character lowercase Note that 'alphabetic' is determined by the current locale. For instance, in the default "C" locale characters such as umlaut-a (ä) will not be converted.

string sha1 ( string $str [, bool $raw_output = false ] )

raw_output - If the optional raw_output is set to TRUE, then the sha1 digest is instead returned in raw binary format with a length of 20, otherwise the returned value is a 40-character hexadecimal number.

mixed count_chars ( string $string [, int $mode = 0 ] )

return an array with the ascii value as the index and the number of times each character occured in the string. Or possibly a string based on the mode used # 0 - an array with ascii value as the index and the of occurrence of each as value. # 1 - same as 0 but only chars with a frequency greater than zero are listed. # 2 - same as 0 but only char with a frequency equal to zero are listed. # 3 - a string containing all unique characters is returned. # 4 - a string containing all not used characters is returned ex. "adej"

string money_format ( string $format , float $number )

returns a formatted version of number. This function wraps the C library function strfmon(), with the difference that this implementation converts only one number at a time. Available only in linux. it does not round format: #n - Left precision .p - Right precision i - format international ex. for US currency is USD n - format local for ex. Denmark is EU ex. // %i, let's print the international format for the en_US locale setlocale(LC_MONETARY, 'en_US'); echo money_format('%i', $number) . "\n"; // USD 1,234.56 // Italian national format with 2 decimals` echo money_format('%.2n', $number) . "\n"; // US national format, using () for negative numbers // and 10 digits for left precision echo money_format('%(#10n', $number) . "\n"; // ($ 1,234.57)

array localeconv ( void )

returns an array with local settings. ex. the decimal points symbol, currency symbol, thousands seperator

string strpbrk ( string $haystack , string $char_list )

searches the haystack for a character from the second parameter and return the haystack starting from that position(Case sensitive) Returns a string starting from the character found, or FALSE if it is not found. $text = 'This is a Simple text.'; //"is is a Simple text." echo strpbrk($text, 'mi'); //"Simple text." echo strpbrk($text, 'S');

void echo ( string $arg1 [, string $... ] )

similar to print. it outputs to the screen. is not actually a function (it is a language construct), so you are not required to use parentheses with it. echo() (unlike some other language constructs) does not behave like a function, so it cannot always be used in the context of a function. Additionally, if you want to pass more than one parameter to echo(), the parameters must not be enclosed within parentheses. echo() also has a shortcut syntax, where you can immediately follow the opening tag with an equals sign. This short syntax only works with the short_open_tag configuration setting enabled.

int printf ( string $format [, mixed $args [, mixed $... ]] )

similar to sprintf but in outputs to the screen instead

array str_split ( string $string [, int $split_length = 1 ] )

split a string into an an array based on the length you specified. default length is 1

string strtok ( string $str [, string $token ])

splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token. That is, if you have a string like "This is an example string" you could tokenize this string into its individual words by using the space character as the token. The token is not included in the returned string. Note that only the first call to strtok uses the string argument. Every subsequent call to strtok only needs the token to use, as it keeps track of where it is in the current string. To start over, or to tokenize a new string you simply call strtok with the string argument again to initialize it. Note that you may put multiple tokens in the token parameter. The string will be tokenized when any one of the characters in the argument are found.

int substr_count ( string $haystack , string $needle [, int $offset = 0 [, int $length ]] )

substr_count — Count the number of substring occurrences This function doesn't count overlapped substrings. See the example below!

string chr ( int $ascii )

take the ascii code and return its string representation

int print ( string $arg )

this is similar to "echo" it is not actually a real function (it is a language construct) so you are not required to use parentheses with its argument list.

string crypt ( string $str [, string $salt ] )

will return a hashed string using the standard Unix DES-based algorithm or alternative algorithms that may be available on the system. <?php $password = crypt('mypassword'); // let the salt be automatically generated if (crypt($user_input, $password) == $password) { echo "Password verified!"; }


Conjuntos de estudio relacionados

CH. 57 MANAGEMENT OF PATIENTS WITH BURN INJURY PREPU

View Set

Microbiology - Chapter 19 - Connect, learn smart assignment

View Set

Direkt interaktiv 2 Lektion 15 2/2

View Set

Behavior change procedure quizzes for test 2

View Set