3v4l.org

run code in 500+ PHP versions simultaneously
<?php $strings = [ "paris-chambre-double-classique-avec-option-petit-dejeuner-a-lhotel-trianon-rive-gauche-4-pour-2-personnes-8ae0676c-aba2-4cf2-9391-91096a247672", "paris-chambre-double-standard-avec-petit-dejeuner-et-acces-spa-pour-2-personnes-a-lhotel-le-mareuil-4-f707b0fe-31cb-4507-b7b3-7b91695bff9c" ]; foreach ($strings as $string){ echo preg_replace('/^(.*)-[a-f0-9]+(?:-[a-f0-9]+){4,5}$/', '/$1.html', $string) . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 8
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/Pqmcd
function name:  (null)
number of ops:  10
compiled vars:  !0 = $strings, !1 = $string
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    8     1      > FE_RESET_R                                           $3      !0, ->8
          2    > > FE_FETCH_R                                                   $3, !1, ->8
    9     3    >   FRAMELESS_ICALL_3                preg_replace        ~4      '%2F%5E%28.%2A%29-%5Ba-f0-9%5D%2B%28%3F%3A-%5Ba-f0-9%5D%2B%29%7B4%2C5%7D%24%2F', '%2F%241.html'
          4        OP_DATA                                                      !1
          5        CONCAT                                               ~5      ~4, '%0A'
          6        ECHO                                                         ~5
    8     7      > JMP                                                          ->2
          8    >   FE_FREE                                                      $3
   10     9      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
131.2 ms | 474 KiB | 7 Q