array2object

Versions
4.6
array2object($array)

Convert an associative array to an anonymous object.

▾ 7 functions call array2object()

comment_preview in modules/comment.module
node_access in modules/node.module
Determine whether the current user may perform the given operation on the specified node.
node_preview in modules/node.module
Generate a node preview, including a form for further edits.
node_validate in modules/node.module
Perform validation checks on the given node.
node_view in modules/node.module
Generate a display of the given node.
user_edit_form in modules/user.module
_blogapi_mt_extra in modules/blogapi.module
Handles extra information sent by clients according to MovableType's spec.

Code

includes/common.inc, line 423

<?php
function array2object($array) {
  if (is_array($array)) {
    $object = new StdClass();
    foreach ($array as $key => $value) {
      $object->$key = $value;
    }
  }
  else {
    $object = $array;
  }

  return $object;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.