3v4l.org

run code in 300+ PHP versions simultaneously
<?php function codePoints($utf8_str){ //入力をUTF-32に変換 $utf32_str=mb_convert_encoding($utf8_str,'UTF-32','UTF-8'); for($i=0;$i<mb_strlen($utf32_str,'UTF-32');++$i) //1文字ずつ16進文字列に変換 $result[]=bin2hex(mb_substr($utf32_str,$i,1,'UTF-32')); return $result; } //mb_internal_encoding('UTF-8'); $string ='aab'; $pattern = '/aaa/'; if(preg_match_all($pattern, $string, $matches, PREG_OFFSET_CAPTURE)) { echo 'test'; } $string ="⏰⏳"; $test = codePoints($string); echo "$test:".print_r($test,true); $pattern = '/23f0|23f3/'; if(preg_match_all($pattern, $test[0].$test[1], $matches )) { echo 'test2'; }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Warning: Array to string conversion in /in/9Yl4i on line 29 Array:Array ( [0] => 000023f0 [1] => 000023f3 ) test2
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Warning: Array to string conversion in /in/9Yl4i on line 29 Array:Array ( [0] => 000023f0 [1] => 000023f3 ) test2
Output for 7.3.0 - 7.3.31, 7.3.33, 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
Notice: Array to string conversion in /in/9Yl4i on line 29 Array:Array ( [0] => 000023f0 [1] => 000023f3 ) test2
Output for 7.3.32, 7.4.26
Array:Array ( [0] => 000023f0 [1] => 000023f3 ) test2

preferences:
175.71 ms | 401 KiB | 155 Q