3v4l.org

run code in 300+ PHP versions simultaneously
<?php function after($subject, $search) { return $search === '' ? $subject : array_reverse(explode($search, $subject, 2))[0]; } function before($subject, $search) { if ($search === '') { return $subject; } $result = strstr($subject, (string) $search, true); return $result === false ? $subject : $result; } function foo($databaseEngine, $databaseVersion) { if (($databaseEngine === 'mysql' && ( (! strpos($databaseVersion, 'MariaDB') && version_compare($databaseVersion, '8.0.1', '>=')) || (strpos($databaseVersion, 'MariaDB') && version_compare(before(after($databaseVersion, '5.5.5-'), '-'), '10.6.0', '>=')) )) || ($databaseEngine === 'pgsql' && version_compare($databaseVersion, '9.5', '>=')) ) { return 'FOR UPDATE SKIP LOCKED'; } return true; } var_dump(foo('mysql', '5.5.5-10.6.4-MariaDB')); var_dump(foo('mysql', '5.5.5-10.3.4-MariaDB')); var_dump(foo('mysql', '5.5.5-10.6.4-MariaDB-log')); var_dump(foo('mysql', '10.3.31-MariaDB-log - MariaDB Server')); var_dump(foo('mysql', '10.6.4-MariaDB-log - MariaDB Server')); var_dump(foo('mysql', '10.3.31-MariaDB-log-cll-lve - MariaDB Server')); var_dump(foo('mysql', '5.5.5-10.6.4-MariaDB-1:10.6.4+maria~focal')); var_dump(foo('mysql', '5.5.5-10.3.4-MariaDB-1:10.3.4+maria~focal'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jShU9
function name:  (null)
number of ops:  57
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'foo'
          2        SEND_VAL                                                 'mysql'
          3        SEND_VAL                                                 '5.5.5-10.6.4-MariaDB'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
   34     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'foo'
          9        SEND_VAL                                                 'mysql'
         10        SEND_VAL                                                 '5.5.5-10.3.4-MariaDB'
         11        DO_FCALL                                      0  $2      
         12        SEND_VAR                                                 $2
         13        DO_ICALL                                                 
   35    14        INIT_FCALL                                               'var_dump'
         15        INIT_FCALL                                               'foo'
         16        SEND_VAL                                                 'mysql'
         17        SEND_VAL                                                 '5.5.5-10.6.4-MariaDB-log'
         18        DO_FCALL                                      0  $4      
         19        SEND_VAR                                                 $4
         20        DO_ICALL                                                 
   36    21        INIT_FCALL                                               'var_dump'
         22        INIT_FCALL                                               'foo'
         23        SEND_VAL                                                 'mysql'
         24        SEND_VAL                                                 '10.3.31-MariaDB-log+-+MariaDB+Server'
         25        DO_FCALL                                      0  $6      
         26        SEND_VAR                                                 $6
         27        DO_ICALL                                                 
   37    28        INIT_FCALL                                               'var_dump'
         29        INIT_FCALL                                               'foo'
         30        SEND_VAL                                                 'mysql'
         31        SEND_VAL                                                 '10.6.4-MariaDB-log+-+MariaDB+Server'
         32        DO_FCALL                                      0  $8      
         33        SEND_VAR                                                 $8
         34        DO_ICALL                                                 
   38    35        INIT_FCALL                                               'var_dump'
         36        INIT_FCALL                                               'foo'
         37        SEND_VAL                                                 'mysql'
         38        SEND_VAL                                                 '10.3.31-MariaDB-log-cll-lve+-+MariaDB+Server'
         39        DO_FCALL                                      0  $10     
         40        SEND_VAR                                                 $10
         41        DO_ICALL                                                 
   39    42        INIT_FCALL                                               'var_dump'
         43        INIT_FCALL                                               'foo'
         44        SEND_VAL                                                 'mysql'
         45        SEND_VAL                                                 '5.5.5-10.6.4-MariaDB-1%3A10.6.4%2Bmaria%7Efocal'
         46        DO_FCALL                                      0  $12     
         47        SEND_VAR                                                 $12
         48        DO_ICALL                                                 
   40    49        INIT_FCALL                                               'var_dump'
         50        INIT_FCALL                                               'foo'
         51        SEND_VAL                                                 'mysql'
         52        SEND_VAL                                                 '5.5.5-10.3.4-MariaDB-1%3A10.3.4%2Bmaria%7Efocal'
         53        DO_FCALL                                      0  $14     
         54        SEND_VAR                                                 $14
         55        DO_ICALL                                                 
         56      > RETURN                                                   1

Function after:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jShU9
function name:  after
number of ops:  18
compiled vars:  !0 = $subject, !1 = $search
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        IS_IDENTICAL                                             !1, ''
          3      > JMPZ                                                     ~2, ->6
          4    >   QM_ASSIGN                                        ~3      !0
          5      > JMP                                                      ->16
          6    >   INIT_FCALL                                               'array_reverse'
          7        INIT_FCALL                                               'explode'
          8        SEND_VAR                                                 !1
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 2
         11        DO_ICALL                                         $4      
         12        SEND_VAR                                                 $4
         13        DO_ICALL                                         $5      
         14        FETCH_DIM_R                                      ~6      $5, 0
         15        QM_ASSIGN                                        ~3      ~6
         16    > > RETURN                                                   ~3
    6    17*     > RETURN                                                   null

End of function after

Function before:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jShU9
function name:  before
number of ops:  19
compiled vars:  !0 = $subject, !1 = $search, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        IS_IDENTICAL                                             !1, ''
          3      > JMPZ                                                     ~3, ->5
   11     4    > > RETURN                                                   !0
   14     5    >   INIT_FCALL                                               'strstr'
          6        SEND_VAR                                                 !0
          7        CAST                                          6  ~4      !1
          8        SEND_VAL                                                 ~4
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $5      
         11        ASSIGN                                                   !2, $5
   16    12        TYPE_CHECK                                    4          !2
         13      > JMPZ                                                     ~7, ->16
         14    >   QM_ASSIGN                                        ~8      !0
         15      > JMP                                                      ->17
         16    >   QM_ASSIGN                                        ~8      !2
         17    > > RETURN                                                   ~8
   17    18*     > RETURN                                                   null

End of function before

Function foo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 38
Branch analysis from position: 4
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
2 jumps found. (Code = 47) Position 1 = 17, Position 2 = 37
Branch analysis from position: 17
2 jumps found. (Code = 46) Position 1 = 22, Position 2 = 36
Branch analysis from position: 22
2 jumps found. (Code = 47) Position 1 = 39, Position 2 = 48
Branch analysis from position: 39
2 jumps found. (Code = 46) Position 1 = 41, Position 2 = 47
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 50
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
Branch analysis from position: 48
Branch analysis from position: 36
Branch analysis from position: 37
Branch analysis from position: 16
Branch analysis from position: 38
filename:       /in/jShU9
function name:  foo
number of ops:  52
compiled vars:  !0 = $databaseEngine, !1 = $databaseVersion
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   21     2        IS_IDENTICAL                                     ~2      !0, 'mysql'
          3      > JMPZ_EX                                          ~2      ~2, ->38
   22     4    >   INIT_FCALL                                               'strpos'
          5        SEND_VAR                                                 !1
          6        SEND_VAL                                                 'MariaDB'
          7        DO_ICALL                                         $3      
          8        BOOL_NOT                                         ~4      $3
          9      > JMPZ_EX                                          ~4      ~4, ->16
         10    >   INIT_FCALL                                               'version_compare'
         11        SEND_VAR                                                 !1
         12        SEND_VAL                                                 '8.0.1'
         13        SEND_VAL                                                 '%3E%3D'
         14        DO_ICALL                                         $5      
         15        BOOL                                             ~4      $5
         16    > > JMPNZ_EX                                         ~4      ~4, ->37
   23    17    >   INIT_FCALL                                               'strpos'
         18        SEND_VAR                                                 !1
         19        SEND_VAL                                                 'MariaDB'
         20        DO_ICALL                                         $6      
         21      > JMPZ_EX                                          ~7      $6, ->36
         22    >   INIT_FCALL                                               'version_compare'
         23        INIT_FCALL                                               'before'
         24        INIT_FCALL                                               'after'
         25        SEND_VAR                                                 !1
         26        SEND_VAL                                                 '5.5.5-'
         27        DO_FCALL                                      0  $8      
         28        SEND_VAR                                                 $8
         29        SEND_VAL                                                 '-'
         30        DO_FCALL                                      0  $9      
         31        SEND_VAR                                                 $9
         32        SEND_VAL                                                 '10.6.0'
         33        SEND_VAL                                                 '%3E%3D'
         34        DO_ICALL                                         $10     
         35        BOOL                                             ~7      $10
         36    >   BOOL                                             ~4      ~7
         37    >   BOOL                                             ~2      ~4
         38    > > JMPNZ_EX                                         ~2      ~2, ->48
   25    39    >   IS_IDENTICAL                                     ~11     !0, 'pgsql'
         40      > JMPZ_EX                                          ~11     ~11, ->47
         41    >   INIT_FCALL                                               'version_compare'
         42        SEND_VAR                                                 !1
         43        SEND_VAL                                                 '9.5'
         44        SEND_VAL                                                 '%3E%3D'
         45        DO_ICALL                                         $12     
         46        BOOL                                             ~11     $12
         47    >   BOOL                                             ~2      ~11
         48    > > JMPZ                                                     ~2, ->50
   27    49    > > RETURN                                                   'FOR+UPDATE+SKIP+LOCKED'
   30    50    > > RETURN                                                   <true>
   31    51*     > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.57 ms | 1088 KiB | 29 Q