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($matches); 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 = 14, Position 2 = 15
Branch analysis from position: 14
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: 15
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/Ca29r
function name:  (null)
number of ops:  24
compiled vars:  !0 = $values, !1 = $value, !2 = $isValid, !3 = $regexp, !4 = $result, !5 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, <array>
   20     1      > FE_RESET_R                                       $7      !0, ->22
          2    > > FE_FETCH_R                                               $7, !1, ->22
   21     3    >   ASSIGN                                                   !2, <false>
   25     4        ASSIGN                                                   !3, '%2F%5E-%3F%5B0-9%5D%2B%5C.%5B0-9%5D%5B0-9%5D%3F%24%2F'
   26     5        INIT_FCALL                                               'preg_match'
          6        SEND_VAR                                                 !3
          7        SEND_VAR                                                 !1
          8        SEND_REF                                                 !5
          9        DO_ICALL                                         $10     
         10        ASSIGN                                                   !4, $10
   31    11        COUNT                                            ~12     !5
         12        IS_EQUAL                                                 ~12, 1
         13      > JMPZ                                                     ~13, ->15
   32    14    >   ASSIGN                                                   !2, <true>
   34    15    >   INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !5
         17        DO_ICALL                                                 
   36    18      > JMPZ                                                     !2, ->21
   37    19    >   CONCAT                                           ~16     !1, '%0A'
         20        ECHO                                                     ~16
   20    21    > > JMP                                                      ->2
         22    >   FE_FREE                                                  $7
   39    23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.51 ms | 1396 KiB | 17 Q