3v4l.org

run code in 500+ PHP versions simultaneously
<?php function reverseEnglishWords($string) { return preg_replace_callback('/(?!\s)[^\p{Arabic}\r\n]+/u', function ($m) { $tmp = preg_replace_callback('~\b(?:(?:ht|f)tps?://|www\.)\S*\b(*SKIP)(*F)|(\w+)([^\w\s]+)~', function($n) { return strrev($n[2]) . $n[1]; }, $m[0]); return implode(" ", array_reverse( preg_split('~\s+~u', $tmp, -1, PREG_SPLIT_NO_EMPTY) ) ); }, $string); } $s = " این یک تست جدید است Is my English line working just fine? I hope it does... Another one?! Site: http://mysite.com/here این یک جمله جدید است and this is to be continued in English... "; echo reverseEnglishWords($s);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YDjrk
function name:  (null)
number of ops:  6
compiled vars:  !0 = $s
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                       !0, '%0A%D8%A7%DB%8C%D9%86+%DB%8C%DA%A9+%D8%AA%D8%B3%D8%AA+%D8%AC%D8%AF%DB%8C%D8%AF+%D8%A7%D8%B3%D8%AA%0AIs+my+English+line+working+just+fine%3F%0AI+hope+it+does...%0AAnother+one%3F%21%0ASite%3A+http%3A%2F%2Fmysite.com%2Fhere%0A%D8%A7%DB%8C%D9%86+%DB%8C%DA%A9+%D8%AC%D9%85%D9%84%D9%87+%D8%AC%D8%AF%DB%8C%D8%AF+%D8%A7%D8%B3%D8%AA+and+this+is+to+be+continued+in+English...%0A'
   25     1        INIT_FCALL                                                   'reverseenglishwords'
          2        SEND_VAR                                                     !0
          3        DO_FCALL                                          0  $2      
          4        ECHO                                                         $2
          5      > RETURN                                                       1

Function reverseenglishwords:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YDjrk
function name:  reverseEnglishWords
number of ops:  9
compiled vars:  !0 = $string
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    5     1        INIT_FCALL                                                   'preg_replace_callback'
          2        SEND_VAL                                                     '%2F%28%3F%21%5Cs%29%5B%5E%5Cp%7BArabic%7D%5Cr%5Cn%5D%2B%2Fu'
          3        DECLARE_LAMBDA_FUNCTION                              ~1      [0]
   13     4        SEND_VAL                                                     ~1
          5        SEND_VAR                                                     !0
    5     6        DO_ICALL                                             $2      
   13     7      > RETURN                                                       $2
   14     8*     > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YDjrk
function name:  {closure:reverseEnglishWords():5}
number of ops:  21
compiled vars:  !0 = $m, !1 = $tmp
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
    6     1        INIT_FCALL                                                   'preg_replace_callback'
          2        SEND_VAL                                                     '%7E%5Cb%28%3F%3A%28%3F%3Aht%7Cf%29tps%3F%3A%2F%2F%7Cwww%5C.%29%5CS%2A%5Cb%28%2ASKIP%29%28%2AF%29%7C%28%5Cw%2B%29%28%5B%5E%5Cw%5Cs%5D%2B%29%7E'
          3        DECLARE_LAMBDA_FUNCTION                              ~2      [0]
    8     4        SEND_VAL                                                     ~2
          5        FETCH_DIM_R                                          ~3      !0, 0
          6        SEND_VAL                                                     ~3
    6     7        DO_ICALL                                             $4      
          8        ASSIGN                                                       !1, $4
    9     9        INIT_FCALL                                                   'array_reverse'
   10    10        INIT_FCALL                                                   'preg_split'
         11        SEND_VAL                                                     '%7E%5Cs%2B%7Eu'
         12        SEND_VAR                                                     !1
         13        SEND_VAL                                                     -1
         14        SEND_VAL                                                     1
         15        DO_ICALL                                             $6      
         16        SEND_VAR                                                     $6
    9    17        DO_ICALL                                             $7      
         18        FRAMELESS_ICALL_2                implode             ~8      '+', $7
   10    19      > RETURN                                                       ~8
   13    20*     > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YDjrk
function name:  {closure:{closure:reverseEnglishWords():5}:6}
number of ops:  9
compiled vars:  !0 = $n
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
    7     1        INIT_FCALL                                                   'strrev'
          2        FETCH_DIM_R                                          ~1      !0, 2
          3        SEND_VAL                                                     ~1
          4        DO_ICALL                                             $2      
          5        FETCH_DIM_R                                          ~3      !0, 1
          6        CONCAT                                               ~4      $2, ~3
          7      > RETURN                                                       ~4
    8     8*     > RETURN                                                       null

End of Dynamic Function 0

End of Dynamic Function 0

End of function reverseenglishwords

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.95 ms | 3397 KiB | 18 Q