3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '<div><a href=%http://link1%><img></a><a href=%http://link2%><img></a></div>'; $re = '|<div>(<a((?!href)(?!<).)+?href=%([^%]+?)%((?!</a>).)+?</a>){2}</div>|'; $matches = array(); echo('result='.intval(preg_match($re, $string, $matches))."\n"); print_r($matches);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2D5Ok
function name:  (null)
number of ops:  16
compiled vars:  !0 = $string, !1 = $re, !2 = $matches
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%3C%2Fdiv%3E'
    4     1        ASSIGN                                                   !1, '%7C%3Cdiv%3E%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%7B2%7D%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                                         $6      
          8        CAST                                          4  ~7      $6
          9        CONCAT                                           ~8      'result%3D', ~7
         10        CONCAT                                           ~9      ~8, '%0A'
         11        ECHO                                                     ~9
    8    12        INIT_FCALL                                               'print_r'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.29 ms | 1386 KiB | 17 Q