PhpBB Code Doc:Sample Page

The title is incorrect due to technical limitation. PhpBB should be phpBB.

This is a sample page of the proposed wiki.

phpBB functions quick reference
This page will contain an exhaustive list of functions that appear in phpBB2.1/3, and each entry consists of the usage, a short description, and simple examples. Feel free to add, correct, and edit things!

gen_rand_string
Usage : gen_rand_string($num_chars)

Description : Return a random alphanumeric(Limitation: there are no small letters) string of length $num_chars, using time as seed for the random number generator.

Example :

$suggested_password = gen_rand_string(14); echo $suggested_password; // sample output 'EKS973NVOS0EQ1'

request_var
Usage : request_var($var_name, $default [, $multibyte = false])

Description : Return $var_name that is passed through GET or POST. Return $default if the requested variable does not exist or the type of $var_name(not the type of the variable's name, but type of the content of variable) conflict with that of $default(array versus non-array). Also notice the result will get converted to be the same type as $default.

Example :

Suppose the url called is test.php?id=2654001&name=Jimmy echo request_var('id', "0"); // output '2654001'

echo request_var('password', "nothing"); // output 'nothing'

set_var
Usage : set_var(&$result, $var, $type [,$multibyte = false])

Description : Set $result to be $var of type $type. If type is string, it will replace linebreaks, special characters, backslashes, and remove excess space at the start or the end.

Example :

set_var($score, 36.1, "int"); echo $score; // outputs '36'

set_var($message, '  Hello \r, world', "string"); echo $message; // output 'Hello \n, world'

unique_id
Usage : unique_id

Description : Return a more random unique id, using time as seed.

Example : (Help needed in determining the length of output)

$id = unique_id; echo $id; // sample output