Re: AW: [PHP] PHP is Zero
| From: | Matijn Woudt | Date: | Thu, 13 Jun 2013 13:39:31 +0000 |
| Subject: | Re: AW: [PHP] PHP is Zero | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-321397@lists.php.net to get a copy of this message | ||
On Thu, Jun 13, 2013 at 1:49 PM, BUSCHKE Daniel <
Daniel.BUSCHKE@nextiraone.eu> wrote:
> To be more technical:
>
> If intval('8315e839da08e2a7afe6dd12ec58245d') would return NULL instead of
> 8315 then PHP would be still weak-typed and the developer could know that
> the conversion failed. Good idea? Of course NULL should be transparent in
> operations like +. So 0 + NULL should be still 0.
>
> Regards
> Daniel
>
>
It would just break too much. I see lots of scripts that have things like
this:
$var = '12 beers';
echo $var + 4;
and they expect it to be 16 of course.
Or what about badly trimmed strings, when reading from a file it can
include extra line endings and it's so much easier to just ignore that
because PHP will convert it just fine.
- Matijn