3v4l.org

run code in 300+ PHP versions simultaneously
<?php function book($id) { $id = $id[1]; // qui recupero il libro partendo dall'id. $books = array( 'La regola dell\'equilibrio', 'Morte in mare aperto', 'La ballata di Adam Henry' ); if (array_key_exists($id, $books)) { return '['.$books[$id].']'; } return '[Libro non in archivio]'; } $text = "I miei libri preferiti sono:\n[libro=1] e [libro=210]"; $text = preg_replace_callback("/\[libro=(.+?)\]/", 'book', $text); echo $text;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CIcme
function name:  (null)
number of ops:  9
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   ASSIGN                                                   !0, 'I+miei+libri+preferiti+sono%3A%0A%5Blibro%3D1%5D+e+%5Blibro%3D210%5D'
   22     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%2F%5C%5Blibro%3D%28.%2B%3F%29%5C%5D%2F'
          3        SEND_VAL                                                 'book'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ASSIGN                                                   !0, $2
   24     7        ECHO                                                     !0
          8      > RETURN                                                   1

Function book:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CIcme
function name:  book
number of ops:  12
compiled vars:  !0 = $id, !1 = $books
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        FETCH_DIM_R                                      ~2      !0, 1
          2        ASSIGN                                                   !0, ~2
    8     3        ASSIGN                                                   !1, <array>
   14     4        ARRAY_KEY_EXISTS                                         !0, !1
          5      > JMPZ                                                     ~5, ->10
   15     6    >   FETCH_DIM_R                                      ~6      !1, !0
          7        CONCAT                                           ~7      '%5B', ~6
          8        CONCAT                                           ~8      ~7, '%5D'
          9      > RETURN                                                   ~8
   18    10    > > RETURN                                                   '%5BLibro+non+in+archivio%5D'
   19    11*     > RETURN                                                   null

End of function book

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.34 ms | 998 KiB | 14 Q