3v4l.org

run code in 300+ PHP versions simultaneously
<?php $expression = "3rd from last"; preg_match('~^(?P<offset>[0-9]+)(?:st|nd|rd|th)* from (?P<position>start|beginning|last|end|)+$~', $expression, $matches); var_dump($matches);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7pUC1
function name:  (null)
number of ops:  10
compiled vars:  !0 = $expression, !1 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '3rd+from+last'
    4     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%7E%5E%28%3FP%3Coffset%3E%5B0-9%5D%2B%29%28%3F%3Ast%7Cnd%7Crd%7Cth%29%2A+from+%28%3FP%3Cposition%3Estart%7Cbeginning%7Clast%7Cend%7C%29%2B%24%7E'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
    5     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.55 ms | 1385 KiB | 17 Q