3v4l.org

run code in 300+ PHP versions simultaneously
<?php $scan = "00:12:a9:54:f6:a7,Privacy,-52.00,3Com,6,30:91:8f:24:07:d0,RSN: Privacy,-85.00,CenturyLink3873,1,00:0c:e5:46:2d:74,ShortSlotTime,-92.00,WLAN,1,c0:3f:0e:57:87:e8,RSN: Privacy,-94.00,Megan-PC-Wireless,6,00:12:a9:54:f6:a7,ShortPreamble,-45.00,WLAN,7"; $escan = (explode(",",$scan)); class Util { function arrayToObject() { //create an instance of an class without calling class's constructor $object = unserialize( sprintf( 'O:%d:"%s":0:{}', strlen($class), $class ) ); if (is_array($array)) { foreach ($array as $name => $value) { if (!empty($name)) { if(method_exists($object, 'set'.$name)){ $object->{'set'.$name}(Util::arrayToObject($value)); }else{ if(($strict)){ if(property_exists($class, $name)){ $object->$name = Util::arrayToObject($value); } }else{ $object->$name = Util::arrayToObject($value); } } } } return $object; } else { return FALSE; } } } $device = Util::arrayToObject($escan); var_dump($device); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/67nfW
function name:  (null)
number of ops:  14
compiled vars:  !0 = $scan, !1 = $escan, !2 = $device
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '00%3A12%3Aa9%3A54%3Af6%3Aa7%2CPrivacy%2C-52.00%2C3Com%2C6%2C30%3A91%3A8f%3A24%3A07%3Ad0%2CRSN%3A+Privacy%2C-85.00%2CCenturyLink3873%2C1%2C00%3A0c%3Ae5%3A46%3A2d%3A74%2CShortSlotTime%2C-92.00%2CWLAN%2C1%2Cc0%3A3f%3A0e%3A57%3A87%3Ae8%2CRSN%3A+Privacy%2C-94.00%2CMegan-PC-Wireless%2C6%2C00%3A12%3Aa9%3A54%3Af6%3Aa7%2CShortPreamble%2C-45.00%2CWLAN%2C7'
    3     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%2C'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
   38     6        INIT_STATIC_METHOD_CALL                                  'Util', 'arrayToObject'
          7        SEND_VAR                                                 !1
          8        DO_FCALL                                      0  $6      
          9        ASSIGN                                                   !2, $6
   40    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
   42    13      > RETURN                                                   1

Class Util:
Function arraytoobject:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 53
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 50
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 50
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 49
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 32
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 44
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 43
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 43
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 49
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/67nfW
function name:  arrayToObject
number of ops:  55
compiled vars:  !0 = $object, !1 = $class, !2 = $array, !3 = $value, !4 = $name, !5 = $strict
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'unserialize'
   11     1        INIT_FCALL                                               'sprintf'
   12     2        SEND_VAL                                                 'O%3A%25d%3A%22%25s%22%3A0%3A%7B%7D'
          3        STRLEN                                           ~6      !1
          4        SEND_VAL                                                 ~6
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $7      
          7        SEND_VAR                                                 $7
          8        DO_ICALL                                         $8      
   10     9        ASSIGN                                                   !0, $8
   15    10        TYPE_CHECK                                  128          !2
         11      > JMPZ                                                     ~10, ->53
   16    12    > > FE_RESET_R                                       $11     !2, ->50
         13    > > FE_FETCH_R                                       ~12     $11, !3, ->50
         14    >   ASSIGN                                                   !4, ~12
   17    15        ISSET_ISEMPTY_CV                                 ~14     !4
         16        BOOL_NOT                                         ~15     ~14
         17      > JMPZ                                                     ~15, ->49
   18    18    >   INIT_FCALL                                               'method_exists'
         19        SEND_VAR                                                 !0
         20        CONCAT                                           ~16     'set', !4
         21        SEND_VAL                                                 ~16
         22        DO_ICALL                                         $17     
         23      > JMPZ                                                     $17, ->32
   19    24    >   CONCAT                                           ~18     'set', !4
         25        INIT_METHOD_CALL                                         !0, ~18
         26        INIT_STATIC_METHOD_CALL                                  'Util', 'arrayToObject'
         27        SEND_VAR                                                 !3
         28        DO_FCALL                                      0  $19     
         29        SEND_VAR_NO_REF_EX                                       $19
         30        DO_FCALL                                      0          
         31      > JMP                                                      ->49
   21    32    > > JMPZ                                                     !5, ->44
   22    33    >   INIT_FCALL                                               'property_exists'
         34        SEND_VAR                                                 !1
         35        SEND_VAR                                                 !4
         36        DO_ICALL                                         $21     
         37      > JMPZ                                                     $21, ->43
   23    38    >   INIT_STATIC_METHOD_CALL                                  'Util', 'arrayToObject'
         39        SEND_VAR                                                 !3
         40        DO_FCALL                                      0  $23     
         41        ASSIGN_OBJ                                               !0, !4
         42        OP_DATA                                                  $23
         43    > > JMP                                                      ->49
   26    44    >   INIT_STATIC_METHOD_CALL                                  'Util', 'arrayToObject'
         45        SEND_VAR                                                 !3
         46        DO_FCALL                                      0  $25     
         47        ASSIGN_OBJ                                               !0, !4
         48        OP_DATA                                                  $25
   16    49    > > JMP                                                      ->13
         50    >   FE_FREE                                                  $11
   31    51      > RETURN                                                   !0
         52*       JMP                                                      ->54
   33    53    > > RETURN                                                   <false>
   35    54*     > RETURN                                                   null

End of function arraytoobject

End of class Util.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.99 ms | 1404 KiB | 25 Q