3v4l.org

run code in 300+ PHP versions simultaneously
<?php $values = array( 0, 1, '1', 1.1, 1.00, 1.01, 2.33, 3.445, -3.45, 12.3432 ); foreach($values as $value) { $isValid = false; // $value = abs($value); //$regexp = '/^[0-9]+\.[0-9][0-9]?$/'; //$result = preg_match($regexp, $value, $matches); $regexp = '/^[0-9]+?$/'; var_dump((bool)preg_match($regexp, $value, $matches)); if(count($matches) == 1) $isValid = true; //var_dump($result); if($isValid) { echo $value."\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 = 17, Position 2 = 18
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 21
Branch analysis from position: 18
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/PfF40
function name:  (null)
number of ops:  24
compiled vars:  !0 = $values, !1 = $value, !2 = $isValid, !3 = $regexp, !4 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, <array>
   20     1      > FE_RESET_R                                       $6      !0, ->22
          2    > > FE_FETCH_R                                               $6, !1, ->22
   21     3    >   ASSIGN                                                   !2, <false>
   28     4        ASSIGN                                                   !3, '%2F%5E%5B0-9%5D%2B%3F%24%2F'
   29     5        INIT_FCALL                                               'var_dump'
          6        INIT_FCALL                                               'preg_match'
          7        SEND_VAR                                                 !3
          8        SEND_VAR                                                 !1
          9        SEND_REF                                                 !4
         10        DO_ICALL                                         $9      
         11        BOOL                                             ~10     $9
         12        SEND_VAL                                                 ~10
         13        DO_ICALL                                                 
   31    14        COUNT                                            ~12     !4
         15        IS_EQUAL                                                 ~12, 1
         16      > JMPZ                                                     ~13, ->18
   32    17    >   ASSIGN                                                   !2, <true>
   36    18    > > JMPZ                                                     !2, ->21
   37    19    >   CONCAT                                           ~15     !1, '%0A'
         20        ECHO                                                     ~15
   20    21    > > JMP                                                      ->2
         22    >   FE_FREE                                                  $6
   39    23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.26 ms | 1395 KiB | 17 Q