3v4l.org

run code in 300+ PHP versions simultaneously
<?php function encodeToUtf8($string) { return mb_convert_encoding($string, "UTF-8", mb_detect_encoding($string, "UTF-8, ISO-8859-1, ISO-8859-15", true)); } function encodeToIso($string) { return mb_convert_encoding($string, "ISO-8859-1", mb_detect_encoding($string, "UTF-8, ISO-8859-1, ISO-8859-15", true)); } //echo mb_detect_encoding('¶¶A une quinzaine de¶kilomètres de la nécropole '); echo utf8_encode('¶¶A une quinzaine de¶kilomètres de la nécropole '); echo encodeToIso('¶¶A une quinzaine de¶kilomètres de la nécropole ', 'UTF-8', 'ISO-8859-2');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nKPDb
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'utf8_encode'
          1        SEND_VAL                                                 '%C2%B6%C2%B6A+une+quinzaine+de%C2%B6kilom%C3%83%C2%83%C3%82%C2%A8tres+de+la+n%C3%83%C2%83%C3%82%C2%A9cropole+'
          2        DO_ICALL                                         $0      
          3        ECHO                                                     $0
   11     4        INIT_FCALL                                               'encodetoiso'
          5        SEND_VAL                                                 '%C2%B6%C2%B6A+une+quinzaine+de%C2%B6kilom%C3%83%C2%83%C3%82%C2%A8tres+de+la+n%C3%83%C2%83%C3%82%C2%A9cropole+'
          6        SEND_VAL                                                 'UTF-8'
          7        SEND_VAL                                                 'ISO-8859-2'
          8        DO_FCALL                                      0  $1      
          9        ECHO                                                     $1
         10      > RETURN                                                   1

Function encodetoutf8:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nKPDb
function name:  encodeToUtf8
number of ops:  13
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'mb_convert_encoding'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'UTF-8'
          4        INIT_FCALL                                               'mb_detect_encoding'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 'UTF-8%2C+ISO-8859-1%2C+ISO-8859-15'
          7        SEND_VAL                                                 <true>
          8        DO_ICALL                                         $1      
          9        SEND_VAR                                                 $1
         10        DO_ICALL                                         $2      
         11      > RETURN                                                   $2
    4    12*     > RETURN                                                   null

End of function encodetoutf8

Function encodetoiso:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nKPDb
function name:  encodeToIso
number of ops:  13
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'mb_convert_encoding'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'ISO-8859-1'
          4        INIT_FCALL                                               'mb_detect_encoding'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 'UTF-8%2C+ISO-8859-1%2C+ISO-8859-15'
          7        SEND_VAL                                                 <true>
          8        DO_ICALL                                         $1      
          9        SEND_VAR                                                 $1
         10        DO_ICALL                                         $2      
         11      > RETURN                                                   $2
    8    12*     > RETURN                                                   null

End of function encodetoiso

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.77 ms | 1403 KiB | 20 Q