Params Extension ---------------- Array params_parse(string $format, ...); $format is a type specifier string containin one or more of the following type specifiers: b The parameter will be converted to boolean and added to the output stack l The parameter will be converted to long (integer) and added to the output stack d The parameter will be converted to double (float) and added to the output stack s The parameter will be converted to string and added to the output stack a The parameter will be converted to array and added to the output stack o The parameter will be converted to an object and added to the output stack O The parameter must be an object of the type(s) specified by the next argument to params_parse() r The parameter must be a resource (of any type) R The parameter must be a resource of the type(s) specified by the next argument to params_parse() z The parameter will be added to the output stack regardless of type * The output stack will be populated with an array containing a variable number of arguments as passed + Same as '*' but at least one var-arg is required A single pipe '|' may be used in the format specifier to split required arguments from optional arguments. If params_parse() is unable to return the requested types (because of 'r', 'R', or 'O' type checking failures or insufficient args), it will return false. Usage: function example() { list($foo, $bar, $baz) = params_parse("slr"); // $foo will be a string // $bar will be a long (integer) // $baz will be a resource } function ex2() { list($foo, $bar, $baz) = params_parse("O|lb", "stdClass"); // $foo will be an object of type stdClass // $bar will be a long (integer), with a default value of 0 // $baz will be a double (float), with a default value of 0.0 } function ex3() { list($foo) = params_parse("O", array("A", "B", "C")); // $foo will be an object of type A, B, or C } function ex4() { list($foo) = params_parse("O", true); // $foo will be an object of any type, but must be passed as an object (will not be converted) } function ex5() { list($fp, $obj) = params_parse("RO", "stream", "stdClass"); // $fp will be a stream (file) resource // $obj will be an object of type stdClass }