3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 'Google', 'Facebook', "Test1112", 'Twitter', 'Slack', 'Twilio' ); usort($array, function ($a, $b) { return strlen($a) < strlen($b); }); $item = reset($array); $result = []; if ($item) { $len = strlen($item); foreach($array as $value) { if (strlen($value) === $len) { $result[] = $value; continue; } break; } } print_r($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 25
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 24
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 24
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 22
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
Branch analysis from position: 24
Branch analysis from position: 25
filename:       /in/q5d8X
function name:  (null)
number of ops:  29
compiled vars:  !0 = $array, !1 = $item, !2 = $result, !3 = $len, !4 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   12     1        INIT_FCALL                                               'usort'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
   14     4        SEND_VAL                                                 ~6
   12     5        DO_ICALL                                                 
   16     6        INIT_FCALL                                               'reset'
          7        SEND_REF                                                 !0
          8        DO_ICALL                                         $8      
          9        ASSIGN                                                   !1, $8
   17    10        ASSIGN                                                   !2, <array>
   19    11      > JMPZ                                                     !1, ->25
   20    12    >   STRLEN                                           ~11     !1
         13        ASSIGN                                                   !3, ~11
   21    14      > FE_RESET_R                                       $13     !0, ->24
         15    > > FE_FETCH_R                                               $13, !4, ->24
   22    16    >   STRLEN                                           ~14     !4
         17        IS_IDENTICAL                                             !3, ~14
         18      > JMPZ                                                     ~15, ->22
   23    19    >   ASSIGN_DIM                                               !2
         20        OP_DATA                                                  !4
   24    21      > JMP                                                      ->15
   26    22    > > JMP                                                      ->24
   21    23*       JMP                                                      ->15
         24    >   FE_FREE                                                  $13
   30    25    >   INIT_FCALL                                               'print_r'
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                                 
         28      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q5d8X
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2        STRLEN                                           ~2      !0
          3        STRLEN                                           ~3      !1
          4        IS_SMALLER                                       ~4      ~2, ~3
          5      > RETURN                                                   ~4
   14     6*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.62 ms | 1017 KiB | 16 Q