3v4l.org

run code in 300+ PHP versions simultaneously
<?php $images = [ 'images' => [ 1620 => (object) [ 'filename' => 'Brancepeth Blue.png', 'id' => 1620 ], 1621 => (object) [ 'filename' => 'Item Blue.png', 'id' => 1621 ], 1622 => (object) [ 'filename' => 'Item Light Oak.png', 'id' => 1622 ] ] ]; $result = []; foreach ($images['images'] as $id => $obj) { sscanf($obj->filename, '%*s %[^.]', $colour); $result[$id] = ucfirst($colour); } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 25
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 25
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/NTb1L
function name:  (null)
number of ops:  30
compiled vars:  !0 = $images, !1 = $result, !2 = $obj, !3 = $id, !4 = $colour
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   CAST                                          8  ~5      <array>
          1        INIT_ARRAY                                       ~6      ~5, 1620
   10     2        CAST                                          8  ~7      <array>
          3        ADD_ARRAY_ELEMENT                                ~6      ~7, 1621
   14     4        CAST                                          8  ~8      <array>
          5        ADD_ARRAY_ELEMENT                                ~6      ~8, 1622
          6        INIT_ARRAY                                       ~9      ~6, 'images'
    3     7        ASSIGN                                                   !0, ~9
   20     8        ASSIGN                                                   !1, <array>
   21     9        FETCH_DIM_R                                      ~12     !0, 'images'
         10      > FE_RESET_R                                       $13     ~12, ->25
         11    > > FE_FETCH_R                                       ~14     $13, !2, ->25
         12    >   ASSIGN                                                   !3, ~14
   22    13        INIT_FCALL                                               'sscanf'
         14        FETCH_OBJ_R                                      ~16     !2, 'filename'
         15        SEND_VAL                                                 ~16
         16        SEND_VAL                                                 '%25%2As+%25%5B%5E.%5D'
         17        SEND_REF                                                 !4
         18        DO_ICALL                                                 
   23    19        INIT_FCALL                                               'ucfirst'
         20        SEND_VAR                                                 !4
         21        DO_ICALL                                         $19     
         22        ASSIGN_DIM                                               !1, !3
         23        OP_DATA                                                  $19
   21    24      > JMP                                                      ->11
         25    >   FE_FREE                                                  $13
   25    26        INIT_FCALL                                               'var_export'
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
184.62 ms | 1013 KiB | 16 Q