3v4l.org

run code in 300+ PHP versions simultaneously
<?php $emoji = '๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ง'; echo $emoji. "\n"; echo strlen($emoji) . "\n";// 25 echo mb_strlen($emoji) . "\n";// 7 echo mb_strlen($emoji, "UTF-16") . "\n";// 12 var_dump(str_split($emoji)); // ่ฌŽใฎ 25 ๆ–‡ๅญ—้…ๅˆ— var_dump(mb_str_split($emoji)); // ็ตตๆ–‡ๅญ— 4 ใคใจ้•ทใ• 3 ใจใ•ใ‚Œใ‚‹่ฆ‹ใŸ็›ฎใ‹ใ‚‰ๆ–‡ๅญ—ๅˆ— 3 ใคใฎ 7 ๆ–‡ๅญ—้…ๅˆ— var_dump(mb_str_split($emoji, 'UTH-16')); // ็ตตๆ–‡ๅญ— 4 ใคใจ้•ทใ• 3 ใจใ•ใ‚Œใ‚‹่ฆ‹ใŸ็›ฎใ‹ใ‚‰ๆ–‡ๅญ—ๅˆ— 3 ใคใฎ 7 ๆ–‡ๅญ—้…ๅˆ— preg_match('/.{1,3}/', $emoji, $match); var_dump($match);// ่ฌŽใฎ 3 ๆ–‡ๅญ—
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qme05
function name:  (null)
number of ops:  45
compiled vars:  !0 = $emoji, !1 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%F0%9F%91%A9%E2%80%8D%F0%9F%91%A9%E2%80%8D%F0%9F%91%A7%E2%80%8D%F0%9F%91%A7'
    4     1        CONCAT                                           ~3      !0, '%0A'
          2        ECHO                                                     ~3
    5     3        STRLEN                                           ~4      !0
          4        CONCAT                                           ~5      ~4, '%0A'
          5        ECHO                                                     ~5
    6     6        INIT_FCALL                                               'mb_strlen'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $6      
          9        CONCAT                                           ~7      $6, '%0A'
         10        ECHO                                                     ~7
    7    11        INIT_FCALL                                               'mb_strlen'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 'UTF-16'
         14        DO_ICALL                                         $8      
         15        CONCAT                                           ~9      $8, '%0A'
         16        ECHO                                                     ~9
    8    17        INIT_FCALL                                               'var_dump'
         18        INIT_FCALL                                               'str_split'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                         $10     
         21        SEND_VAR                                                 $10
         22        DO_ICALL                                                 
    9    23        INIT_FCALL                                               'var_dump'
         24        INIT_FCALL                                               'mb_str_split'
         25        SEND_VAR                                                 !0
         26        DO_ICALL                                         $12     
         27        SEND_VAR                                                 $12
         28        DO_ICALL                                                 
   10    29        INIT_FCALL                                               'var_dump'
         30        INIT_FCALL                                               'mb_str_split'
         31        SEND_VAR                                                 !0
         32        SEND_VAL                                                 'UTH-16'
         33        DO_ICALL                                         $14     
         34        SEND_VAR                                                 $14
         35        DO_ICALL                                                 
   11    36        INIT_FCALL                                               'preg_match'
         37        SEND_VAL                                                 '%2F.%7B1%2C3%7D%2F'
         38        SEND_VAR                                                 !0
         39        SEND_REF                                                 !1
         40        DO_ICALL                                                 
   12    41        INIT_FCALL                                               'var_dump'
         42        SEND_VAR                                                 !1
         43        DO_ICALL                                                 
         44      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
134.21 ms | 1468 KiB | 18 Q