3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ (object)['serial' => 4444, 'note' => '-'], (object)['serial' => 4444, 'note' => 'information'], (object)['serial' => 111, 'note' => '-'], ]; $serialCounts = array_count_values(array_column($data, 'serial')); foreach ($data as $obj) { printf( '<span class="%s">%s</span>', $serialCounts[$obj->serial] > 1 ? 'text-danger' : 'text-success', $obj->serial ); echo "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 32
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 32
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/GA0WF
function name:  (null)
number of ops:  34
compiled vars:  !0 = $data, !1 = $serialCounts, !2 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   CAST                                          8  ~3      <array>
          1        INIT_ARRAY                                       ~4      ~3
    5     2        CAST                                          8  ~5      <array>
          3        ADD_ARRAY_ELEMENT                                ~4      ~5
    6     4        CAST                                          8  ~6      <array>
          5        ADD_ARRAY_ELEMENT                                ~4      ~6
    3     6        ASSIGN                                                   !0, ~4
    9     7        INIT_FCALL                                               'array_count_values'
          8        INIT_FCALL                                               'array_column'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 'serial'
         11        DO_ICALL                                         $8      
         12        SEND_VAR                                                 $8
         13        DO_ICALL                                         $9      
         14        ASSIGN                                                   !1, $9
   11    15      > FE_RESET_R                                       $11     !0, ->32
         16    > > FE_FETCH_R                                               $11, !2, ->32
   12    17    >   INIT_FCALL                                               'printf'
   13    18        SEND_VAL                                                 '%3Cspan+class%3D%22%25s%22%3E%25s%3C%2Fspan%3E'
   14    19        FETCH_OBJ_R                                      ~12     !2, 'serial'
         20        FETCH_DIM_R                                      ~13     !1, ~12
         21        IS_SMALLER                                               1, ~13
         22      > JMPZ                                                     ~14, ->25
         23    >   QM_ASSIGN                                        ~15     'text-danger'
         24      > JMP                                                      ->26
         25    >   QM_ASSIGN                                        ~15     'text-success'
         26    >   SEND_VAL                                                 ~15
   15    27        FETCH_OBJ_R                                      ~16     !2, 'serial'
         28        SEND_VAL                                                 ~16
   12    29        DO_ICALL                                                 
   17    30        ECHO                                                     '%0A'
   11    31      > JMP                                                      ->16
         32    >   FE_FREE                                                  $11
   18    33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.63 ms | 1013 KiB | 16 Q