hdf_obj_next — Return the next node of a dataset level.
resource hdf_obj_next( | hdf) ; |
resource hdf
;
Returns the next node of an HDF resource hdf
, or null if no more children exist.
Example 17. hdf_obj_next
example
<?php // recursively walk an HDF node, printing the contents function tree_walk($node) { while ($node) { printf("%s => %s<br/>\n", hdf_obj_name($node), hdf_obj_value($node)); tree_walk(hdf_obj_child($node)); // get the next child node $node = hdf_obj_next($node); } } $hdf = hdf_init(); $arr = array('foo' => 'bar', 1 => array('key' => 'value')); // map the array to the HDF hdf_set_node($hdf, '', $arr); // iterate over the HDF tree_walk($hdf); ?>
The above example will output:
=> <br/> foo => bar<br/> 1 => <br/> key => value<br/>