3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = ['black', 'white and black', 'lion', 'fast', 'zebra', 'lion is fast', 'zebra is white']; $str = "zebra is white and black, and lion is fast"; function sortl($a,$b){ return strlen($b)-strlen($a); } usort($arr,'sortl'); foreach($arr as $s){ if(strpos($str, $s) !== false){ $new[] = $s; $str = str_replace($s, "", $str); } } Var_dump($new);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 23
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 23
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 22
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 22
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/7iTHC
function name:  (null)
number of ops:  28
compiled vars:  !0 = $arr, !1 = $str, !2 = $s, !3 = $new
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, 'zebra+is+white+and+black%2C+and+lion+is+fast'
   17     2        INIT_FCALL                                               'usort'
          3        SEND_REF                                                 !0
          4        SEND_VAL                                                 'sortl'
          5        DO_ICALL                                                 
   19     6      > FE_RESET_R                                       $7      !0, ->23
          7    > > FE_FETCH_R                                               $7, !2, ->23
   20     8    >   INIT_FCALL                                               'strpos'
          9        SEND_VAR                                                 !1
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $8      
         12        TYPE_CHECK                                  1018          $8
         13      > JMPZ                                                     ~9, ->22
   21    14    >   ASSIGN_DIM                                               !3
         15        OP_DATA                                                  !2
   22    16        INIT_FCALL                                               'str_replace'
         17        SEND_VAR                                                 !2
         18        SEND_VAL                                                 ''
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                         $11     
         21        ASSIGN                                                   !1, $11
   19    22    > > JMP                                                      ->7
         23    >   FE_FREE                                                  $7
   28    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !3
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

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

End of function sortl

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
295.23 ms | 1018 KiB | 17 Q