boss_iterator_3 - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of boss_iterator_3.php
- <?php
- $tree = array();
- $tree[1][2][3] = 'lemon';
- $tree[1][4] = 'melon';
- $tree[2][3] = 'orange';
- $tree[2][5] = 'grape';
- $tree[3] = 'pineapple';
- print_r($tree);
- $arrayiter = new RecursiveArrayIterator($tree);
- $iteriter = new RecursiveIteratorIterator($arrayiter);
- foreach ($iteriter as $key => $value) {
- $d = $iteriter->getDepth();
- echo "depth=$d k=$key v=$value\n";
- }
File Description
- boss_iterator_3
- PHP Code
- 18 Mar-2021
- 389 Bytes
You can Share it:
Latest PHP Pastes