Page 1 of 1

help needed in ( strstr )

Posted: Thu Apr 08, 2010 9:54 am
by minos_mks
i have a .dat file save on it the user name - the password like :

mina - 12345
mary - 54321
jaky saad - 987654

i need a function to get the user name in a variable and i used this script but it gives me that "wrong parameter count for strstr"

$buffer_line = trim($line);
$buffer_name = strstr($buffer_line, '-', true);

note: i found this exact function on php.net

thank you for your help

Re: help needed in ( strstr )

Posted: Thu Apr 08, 2010 10:02 am
by Technocrat
Are you running php 5.3.x? The before_needle was added in 5.3.0.

Re: help needed in ( strstr )

Posted: Thu Apr 08, 2010 11:50 am
by AbraCadaver
How about:

Code: Select all

list($name, $pass) = explode(' - ', trim($line));

Re: help needed in ( strstr )

Posted: Thu Apr 08, 2010 10:14 pm
by minos_mks
thank you very much , god bless you

Re: help needed in ( strstr )

Posted: Fri Apr 09, 2010 12:06 am
by AbraCadaver
You're welcome. But please pay attention to what Technocrat-Evo has said. When using PHP functions, look at the manual page and see what version the function is included in, as well as the notes as to how the function changed in specific versions.