3v4l.org

run code in 300+ PHP versions simultaneously
<?php function replaceExtension($subject, $search = ['.jpeg', '.jpg'], $replace = ['.png']) { return str_replace($search, $replace, $subject); } $tests = [ 'http://a3.mzstatic.com/us/r30/Purple4/v4/cc/74/5c/cc745cd5-9276-71ce-aaf2-0a4b380a2a1c/screen320x320.jpeg', 'http://is1.acf-7e2e-fe9b-4f2d-19019cbce528/mzl.vtyihyzd.png/0x0ss-85.jpg', 'https://itunes.apple.com/ru/developer/mail.ru-games/id566278107?ign-mpt=uo%3D4', 'https://itunes.apple.com/ru/developer/mail.ru-games/id566278107?ign-mpt=uo%3D4.png', ]; foreach ($tests as $test) { echo replaceExtension($test), PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 9
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/rXjpF
function name:  (null)
number of ops:  11
compiled vars:  !0 = $tests, !1 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                   !0, <array>
   13     1      > FE_RESET_R                                       $3      !0, ->9
          2    > > FE_FETCH_R                                               $3, !1, ->9
   14     3    >   INIT_FCALL                                               'replaceextension'
          4        SEND_VAR                                                 !1
          5        DO_FCALL                                      0  $4      
          6        ECHO                                                     $4
          7        ECHO                                                     '%0A'
   13     8      > JMP                                                      ->2
          9    >   FE_FREE                                                  $3
   15    10      > RETURN                                                   1

Function replaceextension:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rXjpF
function name:  replaceExtension
number of ops:  10
compiled vars:  !0 = $subject, !1 = $search, !2 = $replace
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
          2        RECV_INIT                                        !2      <array>
    4     3        INIT_FCALL                                               'str_replace'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !2
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $3      
          8      > RETURN                                                   $3
    5     9*     > RETURN                                                   null

End of function replaceextension

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.22 ms | 1398 KiB | 16 Q