Voting

Please answer this simple SPAM challenge: min(three, zero)?
(Example: nine)

The Note You're Voting On

webmaster at oehoeboeroe dot nl
8 years ago
You might expect substr('123456', 6) to return an empty string. Instead it returns boolean FALSE.

This behavior should be mentioned in the Return Values section of the manual. Instead it is only mentioned in the Parameters section.

If you need an empty string instead of a boolean FALSE you should typecast the result to a string.

<?php
$a
= substr('123456', 6);              // equivalent to $a = FALSE
$a = (string) substr('123456', 6);   // equivalent to $a = '';
?>

<< Back to user notes page

To Top