diff --git a/reference/strings/functions/addcslashes.xml b/reference/strings/functions/addcslashes.xml index 3362883c70..423b776b6e 100644 --- a/reference/strings/functions/addcslashes.xml +++ b/reference/strings/functions/addcslashes.xml @@ -1,55 +1,55 @@ - + - - - addcslashes - Quote string with slashes in a C style - - - Description - - stringaddcslashes - stringstr - stringcharlist - - - Returns a string with backslashes before characters that are - listed in charlist parameter. 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. - - - 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) 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. - - <function>addcslashes</function> example - + + + addcslashes + Quote string with slashes in a C style + + + Description + + stringaddcslashes + stringstr + stringcharlist + + + Returns a string with backslashes before characters that are + listed in charlist parameter. 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. + + + 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) 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. + + <function>addcslashes</function> example + ]]> - - - - - When you define a sequence of characters in the charlist argument - make sure that you know what characters come between the - characters that you set as the start and end of the range. - - + + + + + When you define a sequence of characters in the charlist argument + make sure that you know what characters come between the + characters that you set as the start and end of the range. + + ]]> - - - Also, if the first character in a range has a higher ASCII value - than the second character in the range, no range will be - constructed. Only the start, end and period characters will be - escaped. Use the ord function to find the - ASCII value for a character. - - + + + Also, if the first character in a range has a higher ASCII value + than the second character in the range, no range will be + constructed. Only the start, end and period characters will be + escaped. Use the ord function to find the + ASCII value for a character. + + ]]> - - - - - See also stripcslashes, - stripslashes, - addslashes, - htmlspecialchars, and - quotemeta. - - - + + + + + See also stripcslashes, + stripslashes, + addslashes, + htmlspecialchars, and + quotemeta. + + + + - - - addslashes - Quote string with slashes - - - Description - - stringaddslashes - stringstr - - - 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). - - - An example use of addslashes is when you're - entering data into a database. For example, to insert the name - O'reilly into a database, you will need to escape - it. Most databases do this with a \ which would - mean O\'reilly. This would only be to get the data - into the database, the extra \ will not be inserted. - Having the PHP directive - magic_quotes_sybase set to on will mean - ' is instead escaped with another - '. - - - The PHP directive - magic_quotes_gpc is on by default, and it - essentially runs addslashes on all GET, POST, - and COOKIE data. Do not use addslashes on - strings that have already been escaped with - magic_quotes_gpc as you'll - then do double escaping. The function - get_magic_quotes_gpc may come in handy for - checking this. - - - - An <function>addslashes</function> example - + + + addslashes + Quote string with slashes + + + Description + + stringaddslashes + stringstr + + + 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). + + + An example use of addslashes is when you're + entering data into a database. For example, to insert the name + O'reilly into a database, you will need to escape + it. Most databases do this with a \ which would + mean O\'reilly. This would only be to get the data + into the database, the extra \ will not be inserted. + Having the PHP directive + magic_quotes_sybase set to on will mean + ' is instead escaped with another + '. + + + The PHP directive + magic_quotes_gpc is on by default, and it + essentially runs addslashes on all GET, POST, + and COOKIE data. Do not use addslashes on + strings that have already been escaped with + magic_quotes_gpc as you'll + then do double escaping. The function + get_magic_quotes_gpc may come in handy for + checking this. + + + + An <function>addslashes</function> example + ]]> - - - - - See also stripslashes, - stripcslashes, - addcslashes, - htmlspecialchars, - quotemeta, and - get_magic_quotes_gpc. - - - + + + + + See also stripslashes, + stripcslashes, + addcslashes, + htmlspecialchars, + quotemeta, and + get_magic_quotes_gpc. + + + + - - - bin2hex - - Convert binary data into hexadecimal representation - - - - Description - - stringbin2hex - stringstr - - - Returns an ASCII string containing the hexadecimal representation - of str. The conversion is done byte-wise - with the high-nibble first. - - - See also pack and unpack. - - - + + + bin2hex + Convert binary data into hexadecimal representation + + + Description + + stringbin2hex + stringstr + + + Returns an ASCII string containing the hexadecimal representation + of str. The conversion is done byte-wise + with the high-nibble first. + + + See also pack and unpack. + + + + - - - chr - Return a specific character - - - Description - - stringchr - intascii - - - Returns a one-character string containing the character specified - by ascii. - - <function>chr</function> example - + + + chr + Return a specific character + + + Description + + stringchr + intascii + + + Returns a one-character string containing the character specified + by ascii. + + <function>chr</function> example + ]]> - - - - - You can find an ASCII-table over here: &url.asciitable;. - - - This function complements ord. See also - sprintf with a format string of - %c. - - - + + + + + You can find an ASCII-table over here: &url.asciitable;. + + + This function complements ord. See also + sprintf with a format string of + %c. + + + + - - - chunk_split - Split a string into smaller chunks - - - Description - - stringchunk_split - stringbody - intchunklen - stringend - - - Can be used to split a string into smaller chunks which is useful for - e.g. converting base64_encode output to match RFC - 2045 semantics. It inserts end (defaults to - "\r\n") every chunklen characters (defaults to - 76). It returns the new string leaving the original string untouched. - - <function>chunk_split</function> example - + + + chunk_split + Split a string into smaller chunks + + + Description + + stringchunk_split + stringbody + intchunklen + stringend + + + Can be used to split a string into smaller chunks which is useful for + e.g. converting base64_encode output to match RFC + 2045 semantics. It inserts end (defaults to + "\r\n") every chunklen characters (defaults to + 76). It returns the new string leaving the original string untouched. + + <function>chunk_split</function> example + ]]> - - - - - See also str_split, - explode, split, - wordwrap and - RFC 2045. - - - + + + + + See also str_split, + explode, split, + wordwrap and + RFC 2045. + + + + - - - convert_cyr_string - - Convert from one Cyrillic character set to another - - - - Description - - stringconvert_cyr_string - stringstr - stringfrom - stringto - - - This function returns the given string converted from one - Cyrillic character set to another. The from - and to arguments are single characters that - represent the source and target Cyrillic character sets. The - supported types are: - - - - k - koi8-r - - - - - w - windows-1251 - - - - - i - iso8859-5 - - - - - a - x-cp866 - - - - - d - x-cp866 - - - - - m - x-mac-cyrillic - - - - + + + convert_cyr_string + Convert from one Cyrillic character set to another + + + Description + + stringconvert_cyr_string + stringstr + stringfrom + stringto + + + This function returns the given string converted from one + Cyrillic character set to another. The from + and to arguments are single characters that + represent the source and target Cyrillic character sets. The + supported types are: + + + + k - koi8-r + + + + + w - windows-1251 + + + + + i - iso8859-5 + + + + + a - x-cp866 + + + + + d - x-cp866 + + + + + m - x-mac-cyrillic + + + + - ¬e.bin-safe; - - + ¬e.bin-safe; + + + convert_uudecode - - Decode a uuencoded string - + Decode a uuencoded string Description diff --git a/reference/strings/functions/convert-uuencode.xml b/reference/strings/functions/convert-uuencode.xml index e74aece892..131d553616 100644 --- a/reference/strings/functions/convert-uuencode.xml +++ b/reference/strings/functions/convert-uuencode.xml @@ -1,11 +1,9 @@ - + convert_uuencode - - Uuencode a string - + Uuencode a string Description diff --git a/reference/strings/functions/count-chars.xml b/reference/strings/functions/count-chars.xml index 2766536ce7..d9b2c73cb0 100644 --- a/reference/strings/functions/count-chars.xml +++ b/reference/strings/functions/count-chars.xml @@ -1,61 +1,59 @@ - + - - - count_chars - - Return information about characters used in a string - - - - Description - - mixedcount_chars - stringstring - intmode - - - Counts the number of occurrences of every byte-value (0..255) in - string and returns it in various ways. - The optional parameter mode defaults to - 0. Depending on mode - count_chars returns one of the following: - - - - 0 - an array with the byte-value as key and the frequency of - every byte as value. - - - - - 1 - same as 0 but only byte-values with a frequency greater - than zero are listed. - - - - - 2 - same as 0 but only byte-values with a frequency equal to - zero are listed. - - - - - 3 - a string containing all used byte-values is returned. - - - - - 4 - a string containing all not used byte-values is returned. - - - - - - - <function>count_chars</function> example - + + + count_chars + Return information about characters used in a string + + + Description + + mixedcount_chars + stringstring + intmode + + + Counts the number of occurrences of every byte-value (0..255) in + string and returns it in various ways. + The optional parameter mode defaults to + 0. Depending on mode + count_chars returns one of the following: + + + + 0 - an array with the byte-value as key and the frequency of + every byte as value. + + + + + 1 - same as 0 but only byte-values with a frequency greater + than zero are listed. + + + + + 2 - same as 0 but only byte-values with a frequency equal to + zero are listed. + + + + + 3 - a string containing all used byte-values is returned. + + + + + 4 - a string containing all not used byte-values is returned. + + + + + + + <function>count_chars</function> example + $val) { } ?> ]]> - - &example.outputs; - + + &example.outputs; + - - - - - See also strpos and - substr_count. - - - + + + + + See also strpos and + substr_count. + + + + - - - crc32 - Calculates the crc32 polynomial of a string - - - Description - - intcrc32 - stringstr - - - Generates the cyclic redundancy checksum polynomial of 32-bit - lengths of the str. This is usually used - to validate the integrity of data being transmitted. - - - Because PHP's integer type is signed, and many crc32 checksums will - result in negative integers, you need to use the "%u" formatter of - sprintf or printf to get - the string representation of the unsigned crc32 checksum. - - - This second example shows how to print a converted checksum with the - printf function: - - Displaying a crc32 checksum - + + + crc32 + Calculates the crc32 polynomial of a string + + + Description + + intcrc32 + stringstr + + + Generates the cyclic redundancy checksum polynomial of 32-bit + lengths of the str. This is usually used + to validate the integrity of data being transmitted. + + + Because PHP's integer type is signed, and many crc32 checksums will + result in negative integers, you need to use the "%u" formatter of + sprintf or printf to get + the string representation of the unsigned crc32 checksum. + + + This second example shows how to print a converted checksum with the + printf function: + + Displaying a crc32 checksum + ]]> - - - - - See also md5 and sha1. - - - + + + + + See also md5 and sha1. + + + + - - - crypt - One-way string encryption (hashing) - - - Description - - stringcrypt - stringstr - stringsalt - - - crypt will return an encrypted string using the - standard Unix DES-based encryption algorithm or - alternative algorithms that may be available on the system. Arguments - are a string to be encrypted and an optional salt string to base the - encryption on. See the Unix man page for your crypt function for more - information. - + + + crypt + One-way string encryption (hashing) + + + Description + + stringcrypt + stringstr + stringsalt + + + crypt will return an encrypted string using the + standard Unix DES-based encryption algorithm or + alternative algorithms that may be available on the system. Arguments + are a string to be encrypted and an optional salt string to base the + encryption on. See the Unix man page for your crypt function for more + information. + + + If the salt argument is not provided, one will be randomly + generated by PHP each time you call this function. + + + Some operating systems support more than one type of encryption. In + fact, sometimes the standard DES-based encryption is replaced by an + MD5-based encryption algorithm. The encryption type is triggered by the + salt argument. At install time, PHP determines the capabilities of the + crypt function and will accept salts for other encryption types. If no + salt is provided, PHP will auto-generate a standard two character salt by + default, unless the default encryption type on the system is MD5, in + which case a random MD5-compatible salt is generated. PHP sets a + constant named CRYPT_SALT_LENGTH which tells you whether a regular two + character salt applies to your system or the longer twelve character salt + is applicable. + + + If you are using the supplied salt, you should be aware that the salt is + generated once. If you are calling this function repeatedly, this may + impact both appearance and security. + + + The standard DES-based encryption crypt returns the + salt as the first two characters of the output. It also only uses the + first eight characters of str, so longer strings + that start with the same eight characters will generate the same result + (when the same salt is used). + + + On systems where the crypt() function supports multiple + encryption types, the following constants are set to 0 or 1 + depending on whether the given type is available: + + + - If the salt argument is not provided, one will be randomly - generated by PHP each time you call this function. + CRYPT_STD_DES - Standard DES-based encryption with a two character salt + + - Some operating systems support more than one type of encryption. In - fact, sometimes the standard DES-based encryption is replaced by an - MD5-based encryption algorithm. The encryption type is triggered by the - salt argument. At install time, PHP determines the capabilities of the - crypt function and will accept salts for other encryption types. If no - salt is provided, PHP will auto-generate a standard two character salt by - default, unless the default encryption type on the system is MD5, in - which case a random MD5-compatible salt is generated. PHP sets a - constant named CRYPT_SALT_LENGTH which tells you whether a regular two - character salt applies to your system or the longer twelve character salt - is applicable. + CRYPT_EXT_DES - Extended DES-based encryption with a nine character salt + + - If you are using the supplied salt, you should be aware that the salt is - generated once. If you are calling this function repeatedly, this may - impact both appearance and security. + CRYPT_MD5 - MD5 encryption with a twelve character salt starting with + $1$ + + - The standard DES-based encryption crypt returns the - salt as the first two characters of the output. It also only uses the - first eight characters of str, so longer strings - that start with the same eight characters will generate the same result - (when the same salt is used). + CRYPT_BLOWFISH - Blowfish encryption with a sixteen character salt + starting with $2$ or $2a$ - - On systems where the crypt() function supports multiple - encryption types, the following constants are set to 0 or 1 - depending on whether the given type is available: - - - - - CRYPT_STD_DES - Standard DES-based encryption with a two character salt - - - - - CRYPT_EXT_DES - Extended DES-based encryption with a nine character salt - - - - - CRYPT_MD5 - MD5 encryption with a twelve character salt starting with - $1$ - - - - - CRYPT_BLOWFISH - Blowfish encryption with a sixteen character salt - starting with $2$ or $2a$ - - - - - - There is no decrypt function, since crypt - uses a one-way algorithm. - - - - <function>crypt</function> examples - + + + + + There is no decrypt function, since crypt + uses a one-way algorithm. + + + + <function>crypt</function> examples + ]]> - - - - Using <function>crypt</function> with htpasswd - + + + + Using <function>crypt</function> with htpasswd + ]]> - - - - Using <function>crypt</function> with different encryption types - + + + + Using <function>crypt</function> with different encryption types + ]]> - - &example.outputs.similar; - + + &example.outputs.similar; + - - - - See also md5 and the - Mcrypt extension. - - - + + + + See also md5 and the + Mcrypt extension. + + +