3v4l.org

run code in 500+ PHP versions simultaneously
<?php $delimiter = '123'; $func1 = fn(string $prefix): bool => $prefix !== '' && !str_ends_with($prefix, $delimiter); $func2 = fn(string $prefix): bool => !str_ends_with($prefix, $delimiter); $result = $func1('abc'); $result2 = $func1(''); $result3 = $func2('abc'); $result4 = $func2(''); var_dump( $result, $result2, $result3, $result4, );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ot5hv
function name:  (null)
number of ops:  30
compiled vars:  !0 = $delimiter, !1 = $func1, !2 = $func2, !3 = $result, !4 = $result2, !5 = $result3, !6 = $result4
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '123'
    3     1        DECLARE_LAMBDA_FUNCTION                              ~8      [0]
          2        BIND_LEXICAL                                                 ~8, !0
          3        ASSIGN                                                       !1, ~8
    4     4        DECLARE_LAMBDA_FUNCTION                              ~10     [1]
          5        BIND_LEXICAL                                                 ~10, !0
          6        ASSIGN                                                       !2, ~10
    5     7        INIT_DYNAMIC_CALL                                            !1
          8        SEND_VAL_EX                                                  'abc'
          9        DO_FCALL                                          0  $12     
         10        ASSIGN                                                       !3, $12
    6    11        INIT_DYNAMIC_CALL                                            !1
         12        SEND_VAL_EX                                                  ''
         13        DO_FCALL                                          0  $14     
         14        ASSIGN                                                       !4, $14
    8    15        INIT_DYNAMIC_CALL                                            !2
         16        SEND_VAL_EX                                                  'abc'
         17        DO_FCALL                                          0  $16     
         18        ASSIGN                                                       !5, $16
    9    19        INIT_DYNAMIC_CALL                                            !2
         20        SEND_VAL_EX                                                  ''
         21        DO_FCALL                                          0  $18     
         22        ASSIGN                                                       !6, $18
   12    23        INIT_FCALL                                                   'var_dump'
   13    24        SEND_VAR                                                     !3
   14    25        SEND_VAR                                                     !4
   15    26        SEND_VAR                                                     !5
   16    27        SEND_VAR                                                     !6
   12    28        DO_ICALL                                                     
   17    29      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/ot5hv
function name:  {closure:/in/ot5hv:3}
number of ops:  14
compiled vars:  !0 = $prefix, !1 = $delimiter
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
          2        IS_NOT_IDENTICAL                                     ~2      !0, ''
          3      > JMPZ_EX                                              ~2      ~2, ->10
          4    >   INIT_FCALL                                                   'str_ends_with'
          5        SEND_VAR                                                     !0
          6        SEND_VAR                                                     !1
          7        DO_ICALL                                             $3      
          8        BOOL_NOT                                             ~4      $3
          9        BOOL                                                 ~2      ~4
         10    >   VERIFY_RETURN_TYPE                                           ~2
         11      > RETURN                                                       ~2
         12*       VERIFY_RETURN_TYPE                                           
         13*     > RETURN                                                       null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ot5hv
function name:  {closure:/in/ot5hv:4}
number of ops:  11
compiled vars:  !0 = $prefix, !1 = $delimiter
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
          2        INIT_FCALL                                                   'str_ends_with'
          3        SEND_VAR                                                     !0
          4        SEND_VAR                                                     !1
          5        DO_ICALL                                             $2      
          6        BOOL_NOT                                             ~3      $2
          7        VERIFY_RETURN_TYPE                                           ~3
          8      > RETURN                                                       ~3
          9*       VERIFY_RETURN_TYPE                                           
         10*     > RETURN                                                       null

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168.3 ms | 492 KiB | 11 Q