Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sqlite_udf_decode_binary(3) [php man page]

SQLITE_UDF_DECODE_BINARY(3)											       SQLITE_UDF_DECODE_BINARY(3)

sqlite_udf_decode_binary - Decode binary data passed as parameters to anUDF

SYNOPSIS
string sqlite_udf_decode_binary (string $data) DESCRIPTION
Decodes binary data passed as parameters to a UDF. You must call this function on parameters passed to your UDF if you need them to handle binary data, as the binary encoding employed by PHP will obscure the content and of the parameter in its natural, non-coded form. PHP does not perform this encode/decode operation automatically as it would severely impact performance if it did. PARAMETERS
o $data - The encoded data that will be decoded, data that was applied by either sqlite_udf_encode_binary(3) or sqlite_escape_string(3). RETURN VALUES
The decoded string. EXAMPLES
Example #1 binary-safe max_length aggregation function example <?php $data = array( 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', ); $db = sqlite_open(':memory:'); sqlite_query($db, "CREATE TABLE strings(a)"); foreach ($data as $str) { $str = sqlite_escape_string($str); sqlite_query($db, "INSERT INTO strings VALUES ('$str')"); } function max_len_step(&$context, $string) { $string = sqlite_udf_decode_binary($string); if (strlen($string) > $context) { $context = strlen($string); } } function max_len_finalize(&$context) { return $context; } sqlite_create_aggregate($db, 'max_len', 'max_len_step', 'max_len_finalize'); var_dump(sqlite_array_query($db, 'SELECT max_len(a) from strings')); ?> SEE ALSO
sqlite_udf_encode_binary(3), sqlite_create_function(3), sqlite_create_aggregate(3). PHP Documentation Group SQLITE_UDF_DECODE_BINARY(3)

Check Out this Related Man Page

RTRIM(3)								 1								  RTRIM(3)

rtrim - Strip whitespace (or other characters) from the end of a string

SYNOPSIS
string rtrim (string $str, [string $character_mask]) DESCRIPTION
This function returns a string with whitespace stripped from the end of $str. Without the second parameter, rtrim(3) will strip these characters: o " " (ASCII 32 ( 0x20)), an ordinary space. o " " (ASCII 9 ( 0x09)), a tab. o " " (ASCII 10 ( 0x0A)), a new line (line feed). o " " (ASCII 13 ( 0x0D)), a carriage return. o "" (ASCII 0 ( 0x00)), the NULL-byte. o "x0B" (ASCII 11 ( 0x0B)), a vertical tab. PARAMETERS
o $str - The input string. o $character_mask - You can also specify the characters you want to strip, by means of the $character_mask parameter. Simply list all characters that you want to be stripped. With .. you can specify a range of characters. RETURN VALUES
Returns the modified string. EXAMPLES
Example #1 Usage example of rtrim(3) <?php $text = " These are a few words :) ... "; $binary = "x09Example stringx0A"; $hello = "Hello World"; var_dump($text, $binary, $hello); print " "; $trimmed = rtrim($text); var_dump($trimmed); $trimmed = rtrim($text, " ."); var_dump($trimmed); $trimmed = rtrim($hello, "Hdle"); var_dump($trimmed); // trim the ASCII control characters at the end of $binary // (from 0 to 31 inclusive) $clean = rtrim($binary, "x00..x1F"); var_dump($clean); ?> The above example will output: string(32) " These are a few words :) ... " string(16) " Example string " string(11) "Hello World" string(30) " These are a few words :) ..." string(26) " These are a few words :)" string(9) "Hello Wor" string(15) " Example string" SEE ALSO
trim(3), ltrim(3). PHP Documentation Group RTRIM(3)
Man Page