[WORKING] mosBindArrayToObject

Last reviewed: Not reviewed
phpDocumentor

mosBindArrayToObject

Copy the contents of an array into an object.

This function matches fields in the array with attributes of the same name in the object. If a field exists in the array but does not match an attribute in the object then it is ignored. If an attribute exists in the object but does not match an array field then it will be ignored. Object attributes whose name begins with an underscore character are always ignored.

Returns true if successful; false otherwise.

Syntax

boolean mosBindObjectToArray ( array $array, object $obj [, string $ignore [, string $prefix
                                                                         [, boolean $stripSlashes ]]] )

$array
is an associative array of key/value pairs to update.
$obj
is the object to be updated.
$ignore
is a string. If a key name contains this string as a substring then the key/value pair will be ignored. This argument is optional and if omitted will default to an emtpy string.
$prefix
is a prefix string. An array entry will bind to an object attribute only if the field name with the prefix string prepended to it also exists. This parameter is optional and if omitted will default to null.
$stripSlashes
is a flag. If true and magic_quotes_gpc is also true then slashes will be removed from the updated value placed in the object. If false or if magic_quotes_gpc is false then slashes will not be removed.  This parameter is optional and if omitted will default to true.

Defined in

libraries/joomla/functions.php
(includes/joomla.php prior to Joomla 1.1)
(includes/mambo.php prior to Joomla 1.0)

Examples

Example:


Please report any errors on this page to the Developer Documentation Forum.

Last Updated ( Monday, 25 December 2006 )