3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = 'On Monday Liam'; preg_match('/^(Today|Yesterday|On (last )?(Sun|Mon|Tues|Wed|Thurs|Fri|Satur)day )?(.*)/', $text, $matches); $dow = $matches[1]; $dow = preg_replace('/^On /', '', $dow); $date = strtotime('Last '.$dow); $date = now(); print $dow; print date("Y-m-d", $date); var_export($matches);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bI3W5
function name:  (null)
number of ops:  32
compiled vars:  !0 = $text, !1 = $matches, !2 = $dow, !3 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'On+Monday+Liam'
    3     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%5E%28Today%7CYesterday%7COn+%28last+%29%3F%28Sun%7CMon%7CTues%7CWed%7CThurs%7CFri%7CSatur%29day+%29%3F%28.%2A%29%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
    4     6        FETCH_DIM_R                                      ~6      !1, 1
          7        ASSIGN                                                   !2, ~6
    5     8        INIT_FCALL                                               'preg_replace'
          9        SEND_VAL                                                 '%2F%5EOn+%2F'
         10        SEND_VAL                                                 ''
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                         $8      
         13        ASSIGN                                                   !2, $8
    6    14        INIT_FCALL                                               'strtotime'
         15        CONCAT                                           ~10     'Last+', !2
         16        SEND_VAL                                                 ~10
         17        DO_ICALL                                         $11     
         18        ASSIGN                                                   !3, $11
    7    19        INIT_FCALL_BY_NAME                                       'now'
         20        DO_FCALL                                      0  $13     
         21        ASSIGN                                                   !3, $13
    8    22        ECHO                                                     !2
    9    23        INIT_FCALL                                               'date'
         24        SEND_VAL                                                 'Y-m-d'
         25        SEND_VAR                                                 !3
         26        DO_ICALL                                         $15     
         27        ECHO                                                     $15
   10    28        INIT_FCALL                                               'var_export'
         29        SEND_VAR                                                 !1
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.19 ms | 1388 KiB | 23 Q