rugyguvhbuiuygvbh juhiguytfgv - 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.

Name: rugyguvhbuiuygvbh juhiguytfgv fullscreencopydownloadembedprint


Your result can be seen below.

Result of php executing





Full code of rugyguvhbuiuygvbh juhiguytfgv.php

  1. <?php
  2. error_reporting(E_ERROR);
  3.  
  4. $tree = '{"name": "A","items" : [{"name": "B","items" : [{"name": "D"},{"name": "E","items" : [{"name": "G"}]}]},{"name": "C","items" : [{"name": "F","items" : [{"name": "H"},{"name": "I"}]}]}]}';
  5. $tree = json_decode($tree, 1);
  6.  
  7. treeTraversal($tree);
  8.  
  9. function treeTraversal(&$tree)
  10. {
  11.     if (!$tree['items']) {
  12.         return;
  13.     }
  14.  
  15.     $tree['count'] = count($tree['items']);
  16.     
  17.     foreach ($tree['items'] as &$item) {
  18.         treeTraversal($item);
  19.     }
  20. }
  21.  
  22. print_r($tree);
File Description
  • rugyguvhbuiuygvbh juhiguytfgv
  • PHP Code
  • 21 Oct-2021
  • 512 Bytes
You can Share it: