3v4l.org

run code in 300+ PHP versions simultaneously
<?php $boms = array("\xef\xbf\xbe" => '', "\xef\xbf\xbf" => '',); $array = array( "BOMがマルチバイト文字に分断されたもの"=>"あ\xefい\xbf\xbeう\xef\xbfえ\xbfお", "制御文字でBOMが分断されたもの" => "あい\xef\xbf\x07\xbeう\xef\x1f\xbf\xbfえお", "U+FFFE" => "\xef\xbf\xbe", "U+FFFF" => "\xef\xbf\xbf", "1バイト" => "\xef", "2バイト" => "\xef\xbf", "おしい" => "\xef\xbf\x6a" ); foreach($array as $key => $str) { echo $key . " "; echo var_dump(mb_strpos($str, $boms)); }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
BOMがマルチバイト文字に分断されたもの Fatal error: Uncaught TypeError: mb_strpos(): Argument #2 ($needle) must be of type string, array given in /in/EPHcN:16 Stack trace: #0 /in/EPHcN(16): mb_strpos('\xE3\x81\x82\xEF\xE3\x81\x84\xBF\xBE\xE3\x81\x86\xEF\xBF\xE3...', Array) #1 {main} thrown in /in/EPHcN on line 16
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
BOMがマルチバイト文字に分断されたもの Warning: mb_strpos() expects parameter 2 to be string, array given in /in/EPHcN on line 16 NULL 制御文字でBOMが分断されたもの Warning: mb_strpos() expects parameter 2 to be string, array given in /in/EPHcN on line 16 NULL U+FFFE Warning: mb_strpos() expects parameter 2 to be string, array given in /in/EPHcN on line 16 NULL U+FFFF Warning: mb_strpos() expects parameter 2 to be string, array given in /in/EPHcN on line 16 NULL 1バイト Warning: mb_strpos() expects parameter 2 to be string, array given in /in/EPHcN on line 16 NULL 2バイト Warning: mb_strpos() expects parameter 2 to be string, array given in /in/EPHcN on line 16 NULL おしい Warning: mb_strpos() expects parameter 2 to be string, array given in /in/EPHcN on line 16 NULL
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28
BOMがマルチバイト文字に分断されたもの Warning: mb_strpos() expects parameter 2 to be string, array given in /in/EPHcN on line 16 bool(false) 制御文字でBOMが分断されたもの Warning: mb_strpos() expects parameter 2 to be string, array given in /in/EPHcN on line 16 bool(false) U+FFFE Warning: mb_strpos() expects parameter 2 to be string, array given in /in/EPHcN on line 16 bool(false) U+FFFF Warning: mb_strpos() expects parameter 2 to be string, array given in /in/EPHcN on line 16 bool(false) 1バイト Warning: mb_strpos() expects parameter 2 to be string, array given in /in/EPHcN on line 16 bool(false) 2バイト Warning: mb_strpos() expects parameter 2 to be string, array given in /in/EPHcN on line 16 bool(false) おしい Warning: mb_strpos() expects parameter 2 to be string, array given in /in/EPHcN on line 16 bool(false)
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9
BOMがマルチバイト文字に分断されたもの Notice: Array to string conversion in /in/EPHcN on line 16 bool(false) 制御文字でBOMが分断されたもの Notice: Array to string conversion in /in/EPHcN on line 16 bool(false) U+FFFE Notice: Array to string conversion in /in/EPHcN on line 16 bool(false) U+FFFF Notice: Array to string conversion in /in/EPHcN on line 16 bool(false) 1バイト Notice: Array to string conversion in /in/EPHcN on line 16 bool(false) 2バイト Notice: Array to string conversion in /in/EPHcN on line 16 bool(false) おしい Notice: Array to string conversion in /in/EPHcN on line 16 bool(false)

preferences:
284.74 ms | 403 KiB | 398 Q