3v4l.org

run code in 500+ PHP versions simultaneously
<?php $test = <<<URLS https://example.com/cost-center/sub-one/sub-two/article-3/ https://example.com/cost-center/sub-one/sub-three/article-4 https://example.com/cost-center/sub-1/sub-two/sub-three/article-5/ 'https://example.com/cost-center/sub-one/sub-two/article-3/' 'https://example.com/cost-center/sub-1/sub-two/sub-three/article-5' "https://example.com/cost-center/sub-one/sub-three/article-4" "https://example.com/cost-center/sub-1/sub-two/sub-three/article-5/" URLS; echo preg_replace('#https://[^/]+/cost-center/\K([^/\s]+/)+(?=article)#', 'test/', $test);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uC9ZR
function name:  (null)
number of ops:  5
compiled vars:  !0 = $test
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'https%3A%2F%2Fexample.com%2Fcost-center%2Fsub-one%2Fsub-two%2Farticle-3%2F%0Ahttps%3A%2F%2Fexample.com%2Fcost-center%2Fsub-one%2Fsub-three%2Farticle-4%0Ahttps%3A%2F%2Fexample.com%2Fcost-center%2Fsub-1%2Fsub-two%2Fsub-three%2Farticle-5%2F%0A%27https%3A%2F%2Fexample.com%2Fcost-center%2Fsub-one%2Fsub-two%2Farticle-3%2F%27%0A%27https%3A%2F%2Fexample.com%2Fcost-center%2Fsub-1%2Fsub-two%2Fsub-three%2Farticle-5%27%0A%22https%3A%2F%2Fexample.com%2Fcost-center%2Fsub-one%2Fsub-three%2Farticle-4%22%0A%22https%3A%2F%2Fexample.com%2Fcost-center%2Fsub-1%2Fsub-two%2Fsub-three%2Farticle-5%2F%22'
   13     1        FRAMELESS_ICALL_3                preg_replace        ~2      '%23https%3A%2F%2F%5B%5E%2F%5D%2B%2Fcost-center%2F%5CK%28%5B%5E%2F%5Cs%5D%2B%2F%29%2B%28%3F%3Darticle%29%23', 'test%2F'
          2        OP_DATA                                                      !0
          3        ECHO                                                         ~2
          4      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.22 ms | 1757 KiB | 15 Q