3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = ['my', 'test', 'array']; $arrayObject = new \ArrayObject($array); $arrayIterator = $arrayObject->getIterator(); echo json_encode($array), "\n"; echo json_encode(iterator_to_array($arrayObject)), "\n"; echo json_encode(iterator_to_array($arrayIterator)), "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/09dT1
function name:  (null)
number of ops:  30
compiled vars:  !0 = $array, !1 = $arrayObject, !2 = $arrayIterator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        NEW                                              $4      'ArrayObject'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $4
    5     5        INIT_METHOD_CALL                                         !1, 'getIterator'
          6        DO_FCALL                                      0  $7      
          7        ASSIGN                                                   !2, $7
    7     8        INIT_FCALL                                               'json_encode'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $9      
         11        ECHO                                                     $9
         12        ECHO                                                     '%0A'
    8    13        INIT_FCALL                                               'json_encode'
         14        INIT_FCALL                                               'iterator_to_array'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $10     
         17        SEND_VAR                                                 $10
         18        DO_ICALL                                         $11     
         19        ECHO                                                     $11
         20        ECHO                                                     '%0A'
    9    21        INIT_FCALL                                               'json_encode'
         22        INIT_FCALL                                               'iterator_to_array'
         23        SEND_VAR                                                 !2
         24        DO_ICALL                                         $12     
         25        SEND_VAR                                                 $12
         26        DO_ICALL                                         $13     
         27        ECHO                                                     $13
         28        ECHO                                                     '%0A'
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.26 ms | 1399 KiB | 17 Q