3v4l.org

run code in 300+ PHP versions simultaneously
<?php function str_ireplace_assoc(array $replace, $subject) { return str_ireplace(array_keys($replace), array_values($replace), $subject); } function preg_replace_assoc(array $replace, $subject) { return preg_replace(array_keys($replace), array_values($replace), $subject); } $t = "2007-06-21 - Mitja Prinz @ FĂȘte de la Musique, PhB Club, Berlin"; // convert special characters in hex code http://stackoverflow.com/questions/14091341/ // FIXME use this if PHP 5.4+ #$t = mb_strtolower(html_entity_decode($t,ENT_COMPAT|ENT_HTML401,'UTF-8'),'UTF-8'); $str_repl = array( '#xC0;'=>'#xE0;','#xC1;'=>'#xE1;','#xC2;'=>'#xE2;','#xC3;'=>'#xE3;','#xC4;'=>'#xE4;','#xC5;'=>'#xE5;','#x100;'=>'#x101;','#x102;'=>'#x103;','#x104;'=>'#x105;','#x1DE;'=>'#x1DF;','#x1FA;'=>'#x1FB;','#xC6;'=>'#xE6;','#x1FC;'=>'#x1FD;','#x1E02;'=>'#x1E03;','#x106;'=>'#x107;','#xC7;'=>'#xE7;','#x10C;'=>'#x10D;','#x108;'=>'#x109;','#x10A;'=>'#x10B;','#x1E10;'=>'#x1E11;','#x10E;'=>'#x10F;','#x1E0A;'=>'#x1E0B;','#x110;'=>'#x111;','#xD0;'=>'#xF0;','#x1F1;'=>'#x1F3;','#x1F2;'=>'#x1F3;','#x1C4;'=>'#x1C6;','#x1C5;'=>'#x1C6;','#xC8;'=>'#xE8;','#xC9;'=>'#xE9;','#x11A;'=>'#x11B;','#xCA;'=>'#xEA;','#xCB;'=>'#xEB;','#x112;'=>'#x113;','#x114;'=>'#x115;','#x118;'=>'#x119;','#x116;'=>'#x117;','#x1B7;'=>'#x292;','#x1EE;'=>'#x1EF;','#x1E1E;'=>'#x1E1F;','#x1F4;'=>'#x1F5;','#x122;'=>'#x123;','#x1E6;'=>'#x1E7;','#x11C;'=>'#x11D;','#x11E;'=>'#x11F;','#x120;'=>'#x121;','#x1E4;'=>'#x1E5;','#x124;'=>'#x125;','#x126;'=>'#x127;','#xCC;'=>'#xEC;','#xCD;'=>'#xED;','#xCE;'=>'#xEE;','#x128;'=>'#x129;','#xCF;'=>'#xEF;','#x12A;'=>'#x12B;','#x12C;'=>'#x12D;','#x12E;'=>'#x12F;','#x130;'=>'#x131;','#x132;'=>'#x133;','#x134;'=>'#x135;','#x1E30;'=>'#x1E31;','#x136;'=>'#x137;','#x1E8;'=>'#x1E9;','#x139;'=>'#x13A;','#x13B;'=>'#x13C;','#x13D;'=>'#x13E;','#x13F;'=>'#x140;','#x141;'=>'#x142;','#x1C7;'=>'#x1C9;','#x1C8;'=>'#x1C9;','#x1E40;'=>'#x1E41;','#x143;'=>'#x144;','#x145;'=>'#x146;','#x147;'=>'#x148;','#xD1;'=>'#xF1;','#x14A;'=>'#x14B;','#x1CA;'=>'#x1CC;','#x1CB;'=>'#x1CC;','#xD2;'=>'#xF2;','#xD3;'=>'#xF3;','#xD4;'=>'#xF4;','#xD5;'=>'#xF5;','#xD6;'=>'#xF6;','#x14C;'=>'#x14D;','#x14E;'=>'#x14F;','#xD8;'=>'#xF8;','#x150;'=>'#x151;','#x1FE;'=>'#x1FF;','#x152;'=>'#x153;','#x1E56;'=>'#x1E57;','#x154;'=>'#x155;','#x156;'=>'#x157;','#x158;'=>'#x159;','#x15A;'=>'#x15B;','#x15E;'=>'#x15F;','#x160;'=>'#x161;','#x15C;'=>'#x15D;','#x1E60;'=>'#x1E61;','#x162;'=>'#x163;','#x164;'=>'#x165;','#x1E6A;'=>'#x1E6B;','#x166;'=>'#x167;','#xDE;'=>'#xFE;','#xD9;'=>'#xF9;','#xDA;'=>'#xFA;','#xDB;'=>'#xFB;','#x168;'=>'#x169;','#xDC;'=>'#xFC;','#x16E;'=>'#x16F;','#x16A;'=>'#x16B;','#x16C;'=>'#x16D;','#x172;'=>'#x173;','#x170;'=>'#x171;','#x1E80;'=>'#x1E81;','#x1E82;'=>'#x1E83;','#x174;'=>'#x175;','#x1E84;'=>'#x1E85;','#x1EF2;'=>'#x1EF3;','#xDD;'=>'#xFD;','#x176;'=>'#x177;','#x9F;'=>'#xFF;','#x179;'=>'#x17A;','#x17D;'=>'#x17E;','#x17B;'=>'#x17C;', ); $t = str_ireplace_assoc($str_repl, $t); echo $t; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NjGnT
function name:  (null)
number of ops:  9
compiled vars:  !0 = $t, !1 = $str_repl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, '2007-06-21+-+Mitja+Prinz+%40+F%C3%AAte+de+la+Musique%2C+PhB+Club%2C+Berlin'
   15     1        ASSIGN                                                   !1, <array>
   18     2        INIT_FCALL                                               'str_ireplace_assoc'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $4      
          6        ASSIGN                                                   !0, $4
   19     7        ECHO                                                     !0
   20     8      > RETURN                                                   1

Function str_ireplace_assoc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NjGnT
function name:  str_ireplace_assoc
number of ops:  15
compiled vars:  !0 = $replace, !1 = $subject
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        INIT_FCALL                                               'str_ireplace'
          3        INIT_FCALL                                               'array_keys'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        SEND_VAR                                                 $2
          7        INIT_FCALL                                               'array_values'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $3      
         10        SEND_VAR                                                 $3
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $4      
         13      > RETURN                                                   $4
    4    14*     > RETURN                                                   null

End of function str_ireplace_assoc

Function preg_replace_assoc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NjGnT
function name:  preg_replace_assoc
number of ops:  15
compiled vars:  !0 = $replace, !1 = $subject
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        INIT_FCALL                                               'preg_replace'
          3        INIT_FCALL                                               'array_keys'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        SEND_VAR                                                 $2
          7        INIT_FCALL                                               'array_values'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $3      
         10        SEND_VAR                                                 $3
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $4      
         13      > RETURN                                                   $4
    7    14*     > RETURN                                                   null

End of function preg_replace_assoc

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.42 ms | 1407 KiB | 22 Q