Page 1 of 1

[Solved] Undefined fuction in_array()

PostPosted: 09. August 2012 20:36
by Saphir
Hi everyone.

I've just installed xampp on my 12.04LTS, and everything seems to work fine.

But today i've tried to create a little function which checks if there's a particular word in an array generated with str_word_count().

The problem now:
Fatal error: Call to undefined function in_array() in /opt/lampp/htdocs/arya/index.php on line 100


I thought in_array() was a buit-in function though. The strange thing is that it indicates me that the problem is on line 100, though the block starting at this line is:
Code: Select all
if(in_array("CALENDAR", $word)) {
   $wordu[$nbwu] = "calendar";
   $nbwu++;
}

although the previous block (starting on line 96) is:
Code: Select all
if(in_array("DRIVE", $word)) {
   $wordu[$nbwu] = "drive";
   $nbwu++;
}


It seems that the problem always come from the first occurrence of in_array() after the line 100 (if I comment out the line 100 block, it indicates me 104, then 108, etc.

Anybody can help?
Thank by advance, and sorry for my bad English.

Re: Undefined fuction in_array()

PostPosted: 10. August 2012 18:09
by JonB
I think you have 'hidden characters' in your code.

I discovered this by pasting your second code example into a programmer's editor.

Good Luck
8)

Re: Undefined fuction in_array()

PostPosted: 10. August 2012 23:44
by Saphir
You were right, emacs was able to show me some things like underscores between || and in_array(), while gedit wasn't.
Thanks for your reply. :)