php - chunk_split

Split a string into smaller chunks

Description

string chunk_split ( string $body [, int $chunklen [, string $end]] )
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 every chunklen characters.

Parameters



body
The string to be chunked.
chunklen
The chunk length. Defaults to 76.
end
The line ending sequence. Defaults to "\r\n".

Return Values

Returns the chunked string.

Examples


Example 2383. chunk_split() example

<?php 
// format $data using RFC 2045 semantics 
$new_string = chunk_split(base64_encode($data));

?>

php - chroot

Change the root directory

Description

bool chroot ( string $directory )
Changes the root directory of the current process to directory.
This function is only available if your system supports it and you're using the CLI, CGI or Embed SAPI. Also, this function requires root privileges.

Parameters



directory
The new directory

Return Values

Returns TRUE on success or FALSE on failure.

php - chr

Return a specific character

Description

string chr ( int $ascii )
Returns a one-character string containing the character specified by ascii.
This function complements ord().

Parameters



ascii
The ascii code.

Return Values

Returns the specified character.

Examples


Example 2382. chr() example

<?php

$str
= "The string ends in escape: ";

$str .= chr(27); /* add an escape character at the end of $str */

/* Often this is more useful */
$str = sprintf("The string ends in escape: %c", 27);

?>

php - chown

Changes file owner

Description

bool chown ( string $filename, mixed $user )
Attempts to change the owner of the file filename to user user. Only the superuser may change the owner of a file.

Parameters


filename
Path to the file.
user
A user name or number.

Return Values

Returns TRUE on success or FALSE on failure.