3v4l.org

run code in 300+ PHP versions simultaneously
<?php $value = '-1234.5678'; $text = 'value is ' . number_format(-1234.5678, 2, '.', '') . '!'; var_dump($value); $value = round($value, 2); var_dump($value); var_dump((string) $value); var_dump(strpos($text, $value)); var_dump(strpos($text, -1234.4688)); var_dump(strpos($text, (string) $value)); $text = 'value 1234. was here'; var_dump(strpos($text, $value)); var_dump(strpos($text, -1234.4688)); var_dump(strpos($text, (string) $value)); $text = 'unknown result 123.'; var_dump(strpos($text, $value)); var_dump(strpos($text, -1234.4688)); var_dump(strpos($text, (string) $value)); $text = 'some text containing a dot.'; var_dump(strpos($text, $value)); var_dump(strpos($text, -1234.4688)); var_dump(strpos($text, (string) $value));
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.13
string(10) "-1234.5678" float(-1234.57) string(8) "-1234.57" int(9) bool(false) int(9) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false)
Output for 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
string(10) "-1234.5678" float(-1234.57) string(8) "-1234.57" Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in /in/sT9CU on line 11 int(14) Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in /in/sT9CU on line 12 int(14) int(9) Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in /in/sT9CU on line 16 int(10) Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in /in/sT9CU on line 17 int(10) bool(false) Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in /in/sT9CU on line 21 int(18) Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in /in/sT9CU on line 22 int(18) bool(false) Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in /in/sT9CU on line 26 int(26) Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in /in/sT9CU on line 27 int(26) bool(false)
Output for 5.6.38, 7.0.33, 7.1.25, 7.2.0 - 7.2.33, 7.3.32 - 7.3.33
string(10) "-1234.5678" float(-1234.57) string(8) "-1234.57" int(14) int(14) int(9) int(10) int(10) bool(false) int(18) int(18) bool(false) int(26) int(26) bool(false)

preferences:
172.17 ms | 411 KiB | 5 Q