3v4l.org

run code in 300+ PHP versions simultaneously
<?php // questo test è stato usato nel 2002 // lo si vuole avere aggiornato per il 2003 $text = "April fools day is 04/01/2002\n"; $text.= "Last christmas was 12/24/2001\n"; // la funzione di callback function next_year($matches) { // come solito: $matches[0] è il testo riconosciuto completo // $matches[1] la parte riconosciuta per il primo criterio // racchiuso in '(...)' e così via return $matches[1].($matches[2]+1); } echo preg_replace_callback( "|(\d{2}/\d{2}/)(\d{4})|", "next_year", $text); // il risultato sarà: // April fools day is 04/01/2003 // Last christmas was 12/24/2002 ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iWlma
function name:  (null)
number of ops:  9
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 'April+fools+day+is+04%2F01%2F2002%0A'
    5     1        ASSIGN_OP                                     8          !0, 'Last+christmas+was+12%2F24%2F2001%0A'
   14     2        INIT_FCALL                                               'preg_replace_callback'
   15     3        SEND_VAL                                                 '%7C%28%5Cd%7B2%7D%2F%5Cd%7B2%7D%2F%29%28%5Cd%7B4%7D%29%7C'
   16     4        SEND_VAL                                                 'next_year'
   17     5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7        ECHO                                                     $3
   21     8      > RETURN                                                   1

Function next_year:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iWlma
function name:  next_year
number of ops:  7
compiled vars:  !0 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
   12     1        FETCH_DIM_R                                      ~1      !0, 1
          2        FETCH_DIM_R                                      ~2      !0, 2
          3        ADD                                              ~3      ~2, 1
          4        CONCAT                                           ~4      ~1, ~3
          5      > RETURN                                                   ~4
   13     6*     > RETURN                                                   null

End of function next_year

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.24 ms | 1395 KiB | 15 Q