3v4l.org

run code in 500+ PHP versions simultaneously
<?php $datasets = array( // Returns (bool) false. 'an index containing the delimiter' => array( 'permalink_structure' => '/index.php', 'index' => 'index.php#', ), // Returns (int) 1. 'empty index' => array( 'permalink_structure' => '/index.php', 'index' => '', ), // Returns (int) 0. 'an array for index' => array( 'permalink_structure' => '/index.php', 'index' => array( 'index.php' ), ), // Produces a Fatal Error. // 'an object for index' => array( // 'permalink_structure' => '/index.php', // 'index' => (object) array( 'index.php' ), // ), '(int) -1 for index' => array( 'permalink_structure' => '/index.php', 'index' => -1, ), '(int) 0 for index' => array( 'permalink_structure' => '/index.php', 'index' => 0, ), '(int) 1 for index' => array( 'permalink_structure' => '/index.php', 'index' => 1, ), '(float) -1.0 for index' => array( 'permalink_structure' => '/index.php', 'index' => -1.0, ), '(float) 0.0 for index' => array( 'permalink_structure' => '/index.php', 'index' => 0.0, ), '(float) 1.0 for index' => array( 'permalink_structure' => '/index.php', 'index' => 1.0, ), '(bool) true for index' => array( 'permalink_structure' => '/index.php', 'index' => true, ), '(bool) false for index' => array( 'permalink_structure' => '/index.php', 'index' => true, ), // Produces a Fatal Error. // 'an array for permalink structure' => array( // 'permalink_structure' => array( '/index.php' ), // 'index' => 'index.php', // ), // Produces a Fatal Error. // 'an object for permalink structure' => array( // 'permalink_structure' => (object) array( '/index.php' ), // 'index' => 'index.php', // ), '(int) -1 for permalink structure' => array( 'permalink_structure' => -1, 'index' => 'index.php', ), '(int) 0 for permalink structure' => array( 'permalink_structure' => 0, 'index' => 'index.php', ), '(int) 1 for permalink structure' => array( 'permalink_structure' => 1, 'index' => 'index.php', ), '(float) -1.0 for permalink structure' => array( 'permalink_structure' => -1.0, 'index' => 'index.php', ), '(float) 0.0 for permalink structure' => array( 'permalink_structure' => 0.0, 'index' => 'index.php', ), '(float) 1.0 for permalink structure' => array( 'permalink_structure' => 1.0, 'index' => 'index.php', ), '(bool) true for permalink structure' => array( 'permalink_structure' => true, 'index' => 'index.php', ), '(bool) false for permalink structure' => array( 'permalink_structure' => false, 'index' => 'index.php', ), ); foreach ( $datasets as $name => $data ) { $result = preg_match( '#^/*' . $data['index'] . '#', $data['permalink_structure'] ); echo "preg_match() with $name: ", is_int( $result ) ? $result : 'false', "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 22
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 22
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/M94EH
function name:  (null)
number of ops:  24
compiled vars:  !0 = $datasets, !1 = $data, !2 = $name, !3 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
  103     1      > FE_RESET_R                                           $5      !0, ->22
          2    > > FE_FETCH_R                                           ~6      $5, !1, ->22
          3    >   ASSIGN                                                       !2, ~6
  104     4        FETCH_DIM_R                                          ~8      !1, 'index'
          5        CONCAT                                               ~9      '%23%5E%2F%2A', ~8
          6        CONCAT                                               ~10     ~9, '%23'
          7        FETCH_DIM_R                                          ~11     !1, 'permalink_structure'
          8        FRAMELESS_ICALL_2                preg_match          ~12     ~10, ~11
          9        ASSIGN                                                       !3, ~12
  105    10        ROPE_INIT                                         3  ~15     'preg_match%28%29+with+'
         11        ROPE_ADD                                          1  ~15     ~15, !2
         12        ROPE_END                                          2  ~14     ~15, '%3A+'
         13        ECHO                                                         ~14
         14        TYPE_CHECK                                       16          !3
         15      > JMPZ                                                         ~17, ->18
         16    >   QM_ASSIGN                                            ~18     !3
         17      > JMP                                                          ->19
         18    >   QM_ASSIGN                                            ~18     'false'
         19    >   ECHO                                                         ~18
         20        ECHO                                                         '%0A'
  103    21      > JMP                                                          ->2
         22    >   FE_FREE                                                      $5
  106    23      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
180.72 ms | 3923 KiB | 15 Q