3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fs = array(); $fs[] = function ($string, $end) { $len = strlen($end); if ($len == 0) { return true; } if (strlen($string) < $len) { return false; } return (substr_compare($string, $end, -$len, $len)); }; $fs[] = function ($string, $end) { $len = strlen($end); if ($len == 0) { return true; } if (strlen($string) < $len) { return false; } return (substr_compare($string, $end, -$len)); }; $fs[] = function ($string, $end) { $len = strlen($end); if ($len == 0) { return true; } return (substr_compare($string, $end, -$len, $len)); }; $fs[] = function ($string, $end) { $len = strlen($end); if ($len == 0) { return true; } return (substr_compare($string, $end, -$len)); }; $fs[] = function ($string, $end) { $len = strlen($end); return (substr_compare($string, $end, -$len, $len)); }; $fs[] = function ($string, $end) { $len = strlen($end); return (substr_compare($string, $end, -$len)); }; foreach ($fs as $f) { var_dump('---------------------------------'); var_dump($f('foobar', 'foobar')); var_dump($f('foobar', 'foo')); var_dump($f('foobar', 'bar')); var_dump($f('foobar', 'foobarbaz')); var_dump($f('foobar', '')); var_dump($f('', '')); var_dump($f('', 'foobar')); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 74
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 74
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 74
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 74
filename:       /in/cMDtA
function name:  (null)
number of ops:  76
compiled vars:  !0 = $fs, !1 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FcMDtA%3A3%240'
          2        ASSIGN_DIM                                               !0
   13     3        OP_DATA                                                  ~4
   14     4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FcMDtA%3A14%241'
          5        ASSIGN_DIM                                               !0
   24     6        OP_DATA                                                  ~6
   25     7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FcMDtA%3A25%242'
          8        ASSIGN_DIM                                               !0
   32     9        OP_DATA                                                  ~8
   33    10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FcMDtA%3A33%243'
         11        ASSIGN_DIM                                               !0
   40    12        OP_DATA                                                  ~10
   41    13        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FcMDtA%3A41%244'
         14        ASSIGN_DIM                                               !0
   45    15        OP_DATA                                                  ~12
   46    16        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FcMDtA%3A46%245'
         17        ASSIGN_DIM                                               !0
   50    18        OP_DATA                                                  ~14
   53    19      > FE_RESET_R                                       $15     !0, ->74
         20    > > FE_FETCH_R                                               $15, !1, ->74
   54    21    >   INIT_FCALL                                               'var_dump'
         22        SEND_VAL                                                 '---------------------------------'
         23        DO_ICALL                                                 
   55    24        INIT_FCALL                                               'var_dump'
         25        INIT_DYNAMIC_CALL                                        !1
         26        SEND_VAL_EX                                              'foobar'
         27        SEND_VAL_EX                                              'foobar'
         28        DO_FCALL                                      0  $17     
         29        SEND_VAR                                                 $17
         30        DO_ICALL                                                 
   56    31        INIT_FCALL                                               'var_dump'
         32        INIT_DYNAMIC_CALL                                        !1
         33        SEND_VAL_EX                                              'foobar'
         34        SEND_VAL_EX                                              'foo'
         35        DO_FCALL                                      0  $19     
         36        SEND_VAR                                                 $19
         37        DO_ICALL                                                 
   57    38        INIT_FCALL                                               'var_dump'
         39        INIT_DYNAMIC_CALL                                        !1
         40        SEND_VAL_EX                                              'foobar'
         41        SEND_VAL_EX                                              'bar'
         42        DO_FCALL                                      0  $21     
         43        SEND_VAR                                                 $21
         44        DO_ICALL                                                 
   58    45        INIT_FCALL                                               'var_dump'
         46        INIT_DYNAMIC_CALL                                        !1
         47        SEND_VAL_EX                                              'foobar'
         48        SEND_VAL_EX                                              'foobarbaz'
         49        DO_FCALL                                      0  $23     
         50        SEND_VAR                                                 $23
         51        DO_ICALL                                                 
   59    52        INIT_FCALL                                               'var_dump'
         53        INIT_DYNAMIC_CALL                                        !1
         54        SEND_VAL_EX                                              'foobar'
         55        SEND_VAL_EX                                              ''
         56        DO_FCALL                                      0  $25     
         57        SEND_VAR                                                 $25
         58        DO_ICALL                                                 
   60    59        INIT_FCALL                                               'var_dump'
         60        INIT_DYNAMIC_CALL                                        !1
         61        SEND_VAL_EX                                              ''
         62        SEND_VAL_EX                                              ''
         63        DO_FCALL                                      0  $27     
         64        SEND_VAR                                                 $27
         65        DO_ICALL                                                 
   61    66        INIT_FCALL                                               'var_dump'
         67        INIT_DYNAMIC_CALL                                        !1
         68        SEND_VAL_EX                                              ''
         69        SEND_VAL_EX                                              'foobar'
         70        DO_FCALL                                      0  $29     
         71        SEND_VAR                                                 $29
         72        DO_ICALL                                                 
   53    73      > JMP                                                      ->20
         74    >   FE_FREE                                                  $15
   62    75      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FcMDtA%3A3%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cMDtA
function name:  {closure}
number of ops:  20
compiled vars:  !0 = $string, !1 = $end, !2 = $len
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        STRLEN                                           ~3      !1
          3        ASSIGN                                                   !2, ~3
    6     4        IS_EQUAL                                                 !2, 0
          5      > JMPZ                                                     ~5, ->7
    7     6    > > RETURN                                                   <true>
    9     7    >   STRLEN                                           ~6      !0
          8        IS_SMALLER                                               ~6, !2
          9      > JMPZ                                                     ~7, ->11
   10    10    > > RETURN                                                   <false>
   12    11    >   INIT_FCALL                                               'substr_compare'
         12        SEND_VAR                                                 !0
         13        SEND_VAR                                                 !1
         14        MUL                                              ~8      !2, -1
         15        SEND_VAL                                                 ~8
         16        SEND_VAR                                                 !2
         17        DO_ICALL                                         $9      
         18      > RETURN                                                   $9
   13    19*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FcMDtA%3A3%240

Function %00%7Bclosure%7D%2Fin%2FcMDtA%3A14%241:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cMDtA
function name:  {closure}
number of ops:  19
compiled vars:  !0 = $string, !1 = $end, !2 = $len
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2        STRLEN                                           ~3      !1
          3        ASSIGN                                                   !2, ~3
   17     4        IS_EQUAL                                                 !2, 0
          5      > JMPZ                                                     ~5, ->7
   18     6    > > RETURN                                                   <true>
   20     7    >   STRLEN                                           ~6      !0
          8        IS_SMALLER                                               ~6, !2
          9      > JMPZ                                                     ~7, ->11
   21    10    > > RETURN                                                   <false>
   23    11    >   INIT_FCALL                                               'substr_compare'
         12        SEND_VAR                                                 !0
         13        SEND_VAR                                                 !1
         14        MUL                                              ~8      !2, -1
         15        SEND_VAL                                                 ~8
         16        DO_ICALL                                         $9      
         17      > RETURN                                                   $9
   24    18*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FcMDtA%3A14%241

Function %00%7Bclosure%7D%2Fin%2FcMDtA%3A25%242:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cMDtA
function name:  {closure}
number of ops:  16
compiled vars:  !0 = $string, !1 = $end, !2 = $len
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   27     2        STRLEN                                           ~3      !1
          3        ASSIGN                                                   !2, ~3
   28     4        IS_EQUAL                                                 !2, 0
          5      > JMPZ                                                     ~5, ->7
   29     6    > > RETURN                                                   <true>
   31     7    >   INIT_FCALL                                               'substr_compare'
          8        SEND_VAR                                                 !0
          9        SEND_VAR                                                 !1
         10        MUL                                              ~6      !2, -1
         11        SEND_VAL                                                 ~6
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $7      
         14      > RETURN                                                   $7
   32    15*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FcMDtA%3A25%242

Function %00%7Bclosure%7D%2Fin%2FcMDtA%3A33%243:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cMDtA
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $string, !1 = $end, !2 = $len
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   35     2        STRLEN                                           ~3      !1
          3        ASSIGN                                                   !2, ~3
   36     4        IS_EQUAL                                                 !2, 0
          5      > JMPZ                                                     ~5, ->7
   37     6    > > RETURN                                                   <true>
   39     7    >   INIT_FCALL                                               'substr_compare'
          8        SEND_VAR                                                 !0
          9        SEND_VAR                                                 !1
         10        MUL                                              ~6      !2, -1
         11        SEND_VAL                                                 ~6
         12        DO_ICALL                                         $7      
         13      > RETURN                                                   $7
   40    14*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FcMDtA%3A33%243

Function %00%7Bclosure%7D%2Fin%2FcMDtA%3A41%244:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cMDtA
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $string, !1 = $end, !2 = $len
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   43     2        STRLEN                                           ~3      !1
          3        ASSIGN                                                   !2, ~3
   44     4        INIT_FCALL                                               'substr_compare'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        MUL                                              ~5      !2, -1
          8        SEND_VAL                                                 ~5
          9        SEND_VAR                                                 !2
         10        DO_ICALL                                         $6      
         11      > RETURN                                                   $6
   45    12*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FcMDtA%3A41%244

Function %00%7Bclosure%7D%2Fin%2FcMDtA%3A46%245:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cMDtA
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $string, !1 = $end, !2 = $len
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   48     2        STRLEN                                           ~3      !1
          3        ASSIGN                                                   !2, ~3
   49     4        INIT_FCALL                                               'substr_compare'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        MUL                                              ~5      !2, -1
          8        SEND_VAL                                                 ~5
          9        DO_ICALL                                         $6      
         10      > RETURN                                                   $6
   50    11*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FcMDtA%3A46%245

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.38 ms | 1412 KiB | 17 Q