3v4l.org

run code in 300+ 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 = 25
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 25
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/M94EH
function name:  (null)
number of ops:  27
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, ->25
          2    > > FE_FETCH_R                                       ~6      $5, !1, ->25
          3    >   ASSIGN                                                   !2, ~6
  104     4        INIT_FCALL                                               'preg_match'
          5        FETCH_DIM_R                                      ~8      !1, 'index'
          6        CONCAT                                           ~9      '%23%5E%2F%2A', ~8
          7        CONCAT                                           ~10     ~9, '%23'
          8        SEND_VAL                                                 ~10
          9        FETCH_DIM_R                                      ~11     !1, 'permalink_structure'
         10        SEND_VAL                                                 ~11
         11        DO_ICALL                                         $12     
         12        ASSIGN                                                   !3, $12
  105    13        ROPE_INIT                                     3  ~15     'preg_match%28%29+with+'
         14        ROPE_ADD                                      1  ~15     ~15, !2
         15        ROPE_END                                      2  ~14     ~15, '%3A+'
         16        ECHO                                                     ~14
         17        TYPE_CHECK                                   16          !3
         18      > JMPZ                                                     ~17, ->21
         19    >   QM_ASSIGN                                        ~18     !3
         20      > JMP                                                      ->22
         21    >   QM_ASSIGN                                        ~18     'false'
         22    >   ECHO                                                     ~18
         23        ECHO                                                     '%0A'
  103    24      > JMP                                                      ->2
         25    >   FE_FREE                                                  $5
  106    26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.73 ms | 1452 KiB | 14 Q