3v4l.org

run code in 300+ PHP versions simultaneously
<?php function convert_ascii($string) { // Replace Single Curly Quotes $search[] = chr(226).chr(128).chr(152); $replace[] = "'"; $search[] = chr(226).chr(128).chr(153); $replace[] = "'"; // Replace Smart Double Curly Quotes $search[] = chr(226).chr(128).chr(156); $replace[] = '"'; $search[] = chr(226).chr(128).chr(157); $replace[] = '"'; // Replace En Dash $search[] = chr(226).chr(128).chr(147); $replace[] = '--'; // Replace Em Dash $search[] = chr(226).chr(128).chr(148); $replace[] = '---'; // Replace Bullet $search[] = chr(226).chr(128).chr(162); $replace[] = '*'; // Replace Middle Dot $search[] = chr(194).chr(183); $replace[] = '*'; // Replace Ellipsis with three consecutive dots $search[] = chr(226).chr(128).chr(166); $replace[] = '...'; // Apply Replacements $string = str_replace($search, $replace, $string); // Remove any non-ASCII Characters $string = preg_replace("/[^\x01-\x7F]/","", $string); return $string; } $s = "Turn\u00a0things up with an invigorating concoction at Harry's!\u00a0Made using seven different spirits and topped with a can of redbull, get the exclusive Red Bull Trash Can at $18, or flash your Harry's SG App virtual membership card to enjoy it at $16.\u00a0\u00a0\u00a0Terms and conditionsPrices quoted are subject to prevailing government taxes and service charge.\u00a0Promotion is available till 4 September 2016 at all Harry's outlets except for Harry's Shenton Way and the ones within Changi Airport.\u00a0Harry'"; echo convert_ascii($s);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4DeWS
function name:  (null)
number of ops:  6
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   ASSIGN                                                   !0, 'Turn%5Cu00a0things+up+with+an+invigorating+concoction+at+Harry%27s%21%5Cu00a0Made+using+seven+different+spirits+and+topped+with+a+can+of+redbull%2C+get+the+exclusive+Red+Bull+Trash+Can+at+%2418%2C+or+flash+your+Harry%27s+SG+App+virtual+membership+card+to+enjoy+it+at+%2416.%5Cu00a0%5Cu00a0%5Cu00a0Terms+and+conditionsPrices+quoted+are+subject+to+prevailing+government+taxes+and+service+charge.%5Cu00a0Promotion+is+available+till+4+September+2016+at+all+Harry%27s+outlets+except+for+Harry%27s+Shenton+Way+and+the+ones+within+Changi+Airport.%5Cu00a0Harry%27'
   39     1        INIT_FCALL                                               'convert_ascii'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
          5      > RETURN                                                   1

Function convert_ascii:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4DeWS
function name:  convert_ascii
number of ops:  51
compiled vars:  !0 = $string, !1 = $search, !2 = $replace
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    6     1        ASSIGN_DIM                                               !1
          2        OP_DATA                                                  '%E2%80%98'
    7     3        ASSIGN_DIM                                               !2
          4        OP_DATA                                                  '%27'
    8     5        ASSIGN_DIM                                               !1
          6        OP_DATA                                                  '%E2%80%99'
    9     7        ASSIGN_DIM                                               !2
          8        OP_DATA                                                  '%27'
   11     9        ASSIGN_DIM                                               !1
         10        OP_DATA                                                  '%E2%80%9C'
   12    11        ASSIGN_DIM                                               !2
         12        OP_DATA                                                  '%22'
   13    13        ASSIGN_DIM                                               !1
         14        OP_DATA                                                  '%E2%80%9D'
   14    15        ASSIGN_DIM                                               !2
         16        OP_DATA                                                  '%22'
   16    17        ASSIGN_DIM                                               !1
         18        OP_DATA                                                  '%E2%80%93'
   17    19        ASSIGN_DIM                                               !2
         20        OP_DATA                                                  '--'
   19    21        ASSIGN_DIM                                               !1
         22        OP_DATA                                                  '%E2%80%94'
   20    23        ASSIGN_DIM                                               !2
         24        OP_DATA                                                  '---'
   22    25        ASSIGN_DIM                                               !1
         26        OP_DATA                                                  '%E2%80%A2'
   23    27        ASSIGN_DIM                                               !2
         28        OP_DATA                                                  '%2A'
   25    29        ASSIGN_DIM                                               !1
         30        OP_DATA                                                  '%C2%B7'
   26    31        ASSIGN_DIM                                               !2
         32        OP_DATA                                                  '%2A'
   28    33        ASSIGN_DIM                                               !1
         34        OP_DATA                                                  '%E2%80%A6'
   29    35        ASSIGN_DIM                                               !2
         36        OP_DATA                                                  '...'
   31    37        INIT_FCALL                                               'str_replace'
         38        SEND_VAR                                                 !1
         39        SEND_VAR                                                 !2
         40        SEND_VAR                                                 !0
         41        DO_ICALL                                         $21     
         42        ASSIGN                                                   !0, $21
   33    43        INIT_FCALL                                               'preg_replace'
         44        SEND_VAL                                                 '%2F%5B%5E%01-%7F%5D%2F'
         45        SEND_VAL                                                 ''
         46        SEND_VAR                                                 !0
         47        DO_ICALL                                         $23     
         48        ASSIGN                                                   !0, $23
   34    49      > RETURN                                                   !0
   35    50*     > RETURN                                                   null

End of function convert_ascii

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.3 ms | 1407 KiB | 18 Q