When running this PHP code:
// test value
$value = "123456-7890";
// remove blank spaces and explode
$value = str_replace(' ', '', $value);
$value = explode('-', $value);
// check number of digits depending on format
if ((count($value) == 1 && strlen($value[0]) != 10) || (strlen($value[0]) != 6 || strlen($value[1]) != 4))
{
echo "wrong number of digits!";
}
I get the following error:
PHP Fatal error: Call to undefined function () in /Users/Rikard/Desktop/test.php on line 10
As far as I can tell the problem arises in this part: strlen($value[0]) != 10 but I cannot see why it appears, any thoughts?
You see this:
PHP sees this (
•means non-breaking space):It always happens to me when I innocently try to copy some code from Mac/Safari. BTW, I tried to “edit” your question, and copied code from there for further examination.
PHP interprets the non-breaking space as a valid function name, and tries to execute it: