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 文字
Output for git.master, git.master_jit, rfc.property-hooks
👩‍👩‍👧‍👧 25 7 13 array(25) { [0]=> string(1) "�" [1]=> string(1) "�" [2]=> string(1) "�" [3]=> string(1) "�" [4]=> string(1) "�" [5]=> string(1) "�" [6]=> string(1) "�" [7]=> string(1) "�" [8]=> string(1) "�" [9]=> string(1) "�" [10]=> string(1) "�" [11]=> string(1) "�" [12]=> string(1) "�" [13]=> string(1) "�" [14]=> string(1) "�" [15]=> string(1) "�" [16]=> string(1) "�" [17]=> string(1) "�" [18]=> string(1) "�" [19]=> string(1) "�" [20]=> string(1) "�" [21]=> string(1) "�" [22]=> string(1) "�" [23]=> string(1) "�" [24]=> string(1) "�" } array(7) { [0]=> string(4) "👩" [1]=> string(3) "‍" [2]=> string(4) "👩" [3]=> string(3) "‍" [4]=> string(4) "👧" [5]=> string(3) "‍" [6]=> string(4) "👧" } Fatal error: Uncaught TypeError: mb_str_split(): Argument #2 ($length) must be of type int, string given in /in/Qme05:10 Stack trace: #0 /in/Qme05(10): mb_str_split('\xF0\x9F\x91\xA9\xE2\x80\x8D\xF0\x9F\x91\xA9\xE2\x80\x8D\xF0...', 'UTH-16') #1 {main} thrown in /in/Qme05 on line 10
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
41.93 ms | 411 KiB | 6 Q