3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tam=1; function xuatRa($val){ return 'Begin '.$val.' End'; } $html='<ul id="nav"> <li class="levelTop"><a href="/our-product"><span>Our Product</span></a> <div class="sub">[[data-category-sub=122]]</div> </li> <li class="levelTop"><a href="/contacts"><span>Contact</span></a></li> </ul>'; $html=preg_replace_callback("/\[\[.*data-category-main.*=(.*\d;?).*\]\]/", function($data){ return xuatRa($data[1]); },$html); $html=preg_replace_callback("/\[\[.*data-category-sub.*=(.*\d;?).*\]\]/", function($data){ return xuatRa($data[1]); }, $html); var_dump($html);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XRVOJ
function name:  (null)
number of ops:  20
compiled vars:  !0 = $tam, !1 = $html
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 1
    8     1        ASSIGN                                                   !1, '%3Cul+id%3D%22nav%22%3E%0A%3Cli+class%3D%22levelTop%22%3E%3Ca+href%3D%22%2Four-product%22%3E%3Cspan%3EOur+Product%3C%2Fspan%3E%3C%2Fa%3E%0A%3Cdiv+class%3D%22sub%22%3E%5B%5Bdata-category-sub%3D122%5D%5D%3C%2Fdiv%3E%0A%3C%2Fli%3E%0A%3Cli+class%3D%22levelTop%22%3E%3Ca+href%3D%22%2Fcontacts%22%3E%3Cspan%3EContact%3C%2Fspan%3E%3C%2Fa%3E%3C%2Fli%3E%0A%3C%2Ful%3E'
   14     2        INIT_FCALL                                               'preg_replace_callback'
          3        SEND_VAL                                                 '%2F%5C%5B%5C%5B.%2Adata-category-main.%2A%3D%28.%2A%5Cd%3B%3F%29.%2A%5C%5D%5C%5D%2F'
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FXRVOJ%3A14%240'
          5        SEND_VAL                                                 ~4
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !1, $5
   15     9        INIT_FCALL                                               'preg_replace_callback'
         10        SEND_VAL                                                 '%2F%5C%5B%5C%5B.%2Adata-category-sub.%2A%3D%28.%2A%5Cd%3B%3F%29.%2A%5C%5D%5C%5D%2F'
         11        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FXRVOJ%3A15%241'
         12        SEND_VAL                                                 ~7
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $8      
         15        ASSIGN                                                   !1, $8
   16    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Function xuatra:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XRVOJ
function name:  xuatRa
number of ops:  5
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        CONCAT                                           ~1      'Begin+', !0
          2        CONCAT                                           ~2      ~1, '+End'
          3      > RETURN                                                   ~2
    5     4*     > RETURN                                                   null

End of function xuatra

Function %00%7Bclosure%7D%2Fin%2FXRVOJ%3A14%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XRVOJ
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'xuatra'
          2        FETCH_DIM_R                                      ~1      !0, 1
          3        SEND_VAL                                                 ~1
          4        DO_FCALL                                      0  $2      
          5      > RETURN                                                   $2
          6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FXRVOJ%3A14%240

Function %00%7Bclosure%7D%2Fin%2FXRVOJ%3A15%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XRVOJ
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'xuatra'
          2        FETCH_DIM_R                                      ~1      !0, 1
          3        SEND_VAL                                                 ~1
          4        DO_FCALL                                      0  $2      
          5      > RETURN                                                   $2
          6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FXRVOJ%3A15%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.11 ms | 1403 KiB | 19 Q