3v4l.org

run code in 300+ PHP versions simultaneously
<?php function strim($str) { $s1 = preg_replace('/[\pZ\pC]/muS',' ',$str); if(preg_last_error()) { $s1 = preg_replace('/[\pZ\pC]/muS',' ', iconv("UTF-8", "UTF-8//IGNORE", $str)); if(preg_last_error()) { return trim(str_replace(array(' ',' ',' ',' ',' '), ' ', $str)); } } return trim(preg_replace('/ {2,}/muS', ' ', $s1)); } echo "=".strim(" b áóñÑ baba bab")."=";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Jt5Y8
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'strim'
          1        SEND_VAL                                                 '++b+++++%C3%A1%C3%B3%C3%B1%C3%91+++++baba+bab'
          2        DO_FCALL                                      0  $0      
          3        CONCAT                                           ~1      '%3D', $0
          4        CONCAT                                           ~2      ~1, '%3D'
          5        ECHO                                                     ~2
          6      > RETURN                                                   1

Function strim:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 33
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 33
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/Jt5Y8
function name:  strim
number of ops:  43
compiled vars:  !0 = $str, !1 = $s1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%2F%5B%5CpZ%5CpC%5D%2FmuS'
          3        SEND_VAL                                                 '+'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ASSIGN                                                   !1, $2
    5     7        INIT_FCALL                                               'preg_last_error'
          8        DO_ICALL                                         $4      
          9      > JMPZ                                                     $4, ->33
    6    10    >   INIT_FCALL                                               'preg_replace'
         11        SEND_VAL                                                 '%2F%5B%5CpZ%5CpC%5D%2FmuS'
         12        SEND_VAL                                                 '+'
         13        INIT_FCALL_BY_NAME                                       'iconv'
         14        SEND_VAL_EX                                              'UTF-8'
         15        SEND_VAL_EX                                              'UTF-8%2F%2FIGNORE'
         16        SEND_VAR_EX                                              !0
         17        DO_FCALL                                      0  $5      
         18        SEND_VAR                                                 $5
         19        DO_ICALL                                         $6      
         20        ASSIGN                                                   !1, $6
    7    21        INIT_FCALL                                               'preg_last_error'
         22        DO_ICALL                                         $8      
         23      > JMPZ                                                     $8, ->33
    8    24    >   INIT_FCALL                                               'trim'
         25        INIT_FCALL                                               'str_replace'
         26        SEND_VAL                                                 <array>
         27        SEND_VAL                                                 '+'
         28        SEND_VAR                                                 !0
         29        DO_ICALL                                         $9      
         30        SEND_VAR                                                 $9
         31        DO_ICALL                                         $10     
         32      > RETURN                                                   $10
   11    33    >   INIT_FCALL                                               'trim'
         34        INIT_FCALL                                               'preg_replace'
         35        SEND_VAL                                                 '%2F+%7B2%2C%7D%2FmuS'
         36        SEND_VAL                                                 '+'
         37        SEND_VAR                                                 !1
         38        DO_ICALL                                         $11     
         39        SEND_VAR                                                 $11
         40        DO_ICALL                                         $12     
         41      > RETURN                                                   $12
   12    42*     > RETURN                                                   null

End of function strim

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
186.61 ms | 1403 KiB | 22 Q