3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array ( 0 => array( 0 => "a" ), 1 => array( 0 => "b", 1 => "c" ), "a" => array( "b" => "d" ) ); echo "<pre>"; print_r($arr); foreach($arr as $key=>$val){ if(is_array($val) && count($val) == 1){ $arr[$key] = array_shift($val); } } echo "<pre>"; print_r($arr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 20
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 20
Branch analysis from position: 7
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 19
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 19
Branch analysis from position: 13
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/Qmb5J
function name:  (null)
number of ops:  26
compiled vars:  !0 = $arr, !1 = $val, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   15     1        ECHO                                                     '%3Cpre%3E'
          2        INIT_FCALL                                               'print_r'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   16     5      > FE_RESET_R                                       $5      !0, ->20
          6    > > FE_FETCH_R                                       ~6      $5, !1, ->20
          7    >   ASSIGN                                                   !2, ~6
   17     8        TYPE_CHECK                                  128  ~8      !1
          9      > JMPZ_EX                                          ~8      ~8, ->13
         10    >   COUNT                                            ~9      !1
         11        IS_EQUAL                                         ~10     ~9, 1
         12        BOOL                                             ~8      ~10
         13    > > JMPZ                                                     ~8, ->19
   18    14    >   INIT_FCALL                                               'array_shift'
         15        SEND_REF                                                 !1
         16        DO_ICALL                                         $12     
         17        ASSIGN_DIM                                               !0, !2
         18        OP_DATA                                                  $12
   16    19    > > JMP                                                      ->6
         20    >   FE_FREE                                                  $5
   21    21        ECHO                                                     '%3Cpre%3E'
         22        INIT_FCALL                                               'print_r'
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.64 ms | 1396 KiB | 17 Q