3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '<div><a href=%http://link1%><img></a><a href=%http://link2%><img></a><a href=%http://link3%><img></a></div>'; $re = '|<div>((<a((?!href)(?!<).)+?href=%([^%]+?)%((?!</a>).)+?</a>){3})</div>|'; $matches = array(); echo('result='.intval(preg_match($re, $string, $matches))."\n"); echo('$matches='); print_r($matches); $re = '|(?<=</a>)(?=<a)|'; $pieces = preg_split($re, $matches[1]); echo('$pieces='); print_r($pieces);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ufa2S
function name:  (null)
number of ops:  28
compiled vars:  !0 = $string, !1 = $re, !2 = $matches, !3 = $pieces
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cdiv%3E%3Ca+href%3D%25http%3A%2F%2Flink1%25%3E%3Cimg%3E%3C%2Fa%3E%3Ca+href%3D%25http%3A%2F%2Flink2%25%3E%3Cimg%3E%3C%2Fa%3E%3Ca+href%3D%25http%3A%2F%2Flink3%25%3E%3Cimg%3E%3C%2Fa%3E%3C%2Fdiv%3E'
    4     1        ASSIGN                                                   !1, '%7C%3Cdiv%3E%28%28%3Ca%28%28%3F%21href%29%28%3F%21%3C%29.%29%2B%3Fhref%3D%25%28%5B%5E%25%5D%2B%3F%29%25%28%28%3F%21%3C%2Fa%3E%29.%29%2B%3F%3C%2Fa%3E%29%7B3%7D%29%3C%2Fdiv%3E%7C'
    5     2        ASSIGN                                                   !2, <array>
    7     3        INIT_FCALL                                               'preg_match'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !0
          6        SEND_REF                                                 !2
          7        DO_ICALL                                         $7      
          8        CAST                                          4  ~8      $7
          9        CONCAT                                           ~9      'result%3D', ~8
         10        CONCAT                                           ~10     ~9, '%0A'
         11        ECHO                                                     ~10
    8    12        ECHO                                                     '%24matches%3D'
         13        INIT_FCALL                                               'print_r'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
   10    16        ASSIGN                                                   !1, '%7C%28%3F%3C%3D%3C%2Fa%3E%29%28%3F%3D%3Ca%29%7C'
   11    17        INIT_FCALL                                               'preg_split'
         18        SEND_VAR                                                 !1
         19        FETCH_DIM_R                                      ~13     !2, 1
         20        SEND_VAL                                                 ~13
         21        DO_ICALL                                         $14     
         22        ASSIGN                                                   !3, $14
   12    23        ECHO                                                     '%24pieces%3D'
         24        INIT_FCALL                                               'print_r'
         25        SEND_VAR                                                 !3
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
196.17 ms | 1396 KiB | 19 Q