PHP 8.5.0 Beta 1 available for testing

Voting

: eight plus zero?
(Example: nine)

The Note You're Voting On

Jean
6 years ago
When a value can be of "unknow" type, I find this conversion trick usefull and more readable than a formal casting (for php7.3+):

<?php
$time
= time();
$string = 'This is a test: ' . $time;
echo (
strpos($string, $time) !== false ? 'found' : 'not found');
echo (
strpos($string, "$time") !== false ? 'found' : 'not found');
?>

<< Back to user notes page

To Top