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
help needed in ( strstr )
Moderator: General Moderators
- Technocrat
- Forum Contributor
- Posts: 127
- Joined: Thu Oct 20, 2005 7:01 pm
Re: help needed in ( strstr )
Are you running php 5.3.x? The before_needle was added in 5.3.0.
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: help needed in ( strstr )
How about:
Code: Select all
list($name, $pass) = explode(' - ', trim($line));mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: help needed in ( strstr )
thank you very much , god bless you
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: help needed in ( strstr )
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.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.