test - 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.



Your result can be seen below.

Result of php executing





Full code of test.php

  1. <?php
  2.  
  3.  
  4. $arrIcon = [
  5.     'metapolicy_struct' => [0 => '0']
  6. ];
  7.  
  8. $hotelData = [
  9.     'metapolicy_struct' => [
  10.         0 => '0',1 => '1',2 => '2',3 => '3',4 => '4',
  11.     ]   
  12. ];
  13.  
  14.     
  15.     if (isset($hotelData['metapolicy_struct'])){
  16.         $i = 0;
  17.         $metapolicy_struct = [];
  18.         foreach ($hotelData['metapolicy_struct'] as $k => $item) {
  19.             if (array_search($k, $arrIcon['metapolicy_struct']) === false){
  20.                 echo $k . " NO <br/>";
  21.                 $metapolicy_struct[] = trim($k);
  22.             }else{
  23.                 echo $k . "YES <br/>";
  24.             }
  25.             $i++;
  26.         }
  27.         $arrIcon['metapolicy_struct'] = $metapolicy_struct;
  28.     }
  29.  
  30.  
  31. var_dump($arrIcon);
  32.  
File Description
  • test
  • PHP Code
  • 11 Jan-2023
  • 696 Bytes
You can Share it: