3v4l.org

run code in 300+ PHP versions simultaneously
<?php function core_weird_explode(string $splitter, string $subject) { return array_map(function ($w) use ($splitter) { static $l; return $l = ($l?$l.$splitter:'').$w; }, explode($splitter, $subject) ); } var_dump( core_weird_explode(' ', 'foo bar baz'), core_weird_explode('.', 'foo.bar 523.baz 123'), );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5WNvT
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'var_dump'
   16     1        INIT_FCALL                                               'core_weird_explode'
          2        SEND_VAL                                                 '+'
          3        SEND_VAL                                                 'foo+bar+baz'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
   17     6        INIT_FCALL                                               'core_weird_explode'
          7        SEND_VAL                                                 '.'
          8        SEND_VAL                                                 'foo.bar+523.baz+123'
          9        DO_FCALL                                      0  $1      
         10        SEND_VAR                                                 $1
         11        DO_ICALL                                                 
   18    12      > RETURN                                                   1

Function core_weird_explode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5WNvT
function name:  core_weird_explode
number of ops:  14
compiled vars:  !0 = $splitter, !1 = $subject
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'array_map'
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F5WNvT%3A5%240'
          4        BIND_LEXICAL                                             ~2, !0
    9     5        SEND_VAL                                                 ~2
   10     6        INIT_FCALL                                               'explode'
          7        SEND_VAR                                                 !0
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $3      
         10        SEND_VAR                                                 $3
         11        DO_ICALL                                         $4      
         12      > RETURN                                                   $4
   13    13*     > RETURN                                                   null

End of function core_weird_explode

Function %00%7Bclosure%7D%2Fin%2F5WNvT%3A5%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5WNvT
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $w, !1 = $splitter, !2 = $l
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    6     2        BIND_STATIC                                              !2
    7     3      > JMPZ                                                     !2, ->7
          4    >   CONCAT                                           ~3      !2, !1
          5        QM_ASSIGN                                        ~4      ~3
          6      > JMP                                                      ->8
          7    >   QM_ASSIGN                                        ~4      ''
          8    >   CONCAT                                           ~5      ~4, !0
          9        ASSIGN                                           ~6      !2, ~5
         10      > RETURN                                                   ~6
    9    11*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F5WNvT%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.99 ms | 1403 KiB | 21 Q