3v4l.org

run code in 500+ PHP versions simultaneously
<?php $text = "1 out of 23"; echo preg_match('/\d+(?=\D*$)/', $text, $m) ? $m[0] : ''; echo "\n"; echo sscanf($text, '%*d out of %d')[0]; echo "\n--- \n"; $text = "1 out of 23 more"; echo preg_match('/\d+(?=\D*$)/', $text, $m) ? $m[0] : ''; echo "\n"; echo sscanf($text, '%*d out of %d')[0];
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 30
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 30
Branch analysis from position: 27
Branch analysis from position: 30
filename:       /in/oIC7g
function name:  (null)
number of ops:  40
compiled vars:  !0 = $text, !1 = $m
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '1+out+of+23'
    5     1        INIT_FCALL                                                   'preg_match'
          2        SEND_VAL                                                     '%2F%5Cd%2B%28%3F%3D%5CD%2A%24%29%2F'
          3        SEND_VAR                                                     !0
          4        SEND_REF                                                     !1
          5        DO_ICALL                                             $3      
          6      > JMPZ                                                         $3, ->10
          7    >   FETCH_DIM_R                                          ~4      !1, 0
          8        QM_ASSIGN                                            ~5      ~4
          9      > JMP                                                          ->11
         10    >   QM_ASSIGN                                            ~5      ''
         11    >   ECHO                                                         ~5
    6    12        ECHO                                                         '%0A'
    7    13        INIT_FCALL                                                   'sscanf'
         14        SEND_VAR                                                     !0
         15        SEND_VAL                                                     '%25%2Ad+out+of+%25d'
         16        DO_ICALL                                             $6      
         17        FETCH_DIM_R                                          ~7      $6, 0
         18        ECHO                                                         ~7
    9    19        ECHO                                                         '%0A---+%0A'
   11    20        ASSIGN                                                       !0, '1+out+of+23+more'
   13    21        INIT_FCALL                                                   'preg_match'
         22        SEND_VAL                                                     '%2F%5Cd%2B%28%3F%3D%5CD%2A%24%29%2F'
         23        SEND_VAR                                                     !0
         24        SEND_REF                                                     !1
         25        DO_ICALL                                             $9      
         26      > JMPZ                                                         $9, ->30
         27    >   FETCH_DIM_R                                          ~10     !1, 0
         28        QM_ASSIGN                                            ~11     ~10
         29      > JMP                                                          ->31
         30    >   QM_ASSIGN                                            ~11     ''
         31    >   ECHO                                                         ~11
   14    32        ECHO                                                         '%0A'
   15    33        INIT_FCALL                                                   'sscanf'
         34        SEND_VAR                                                     !0
         35        SEND_VAL                                                     '%25%2Ad+out+of+%25d'
         36        DO_ICALL                                             $12     
         37        FETCH_DIM_R                                          ~13     $12, 0
         38        ECHO                                                         ~13
         39      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.53 ms | 1899 KiB | 15 Q