Hello again
I have a PHP statement which goes like this:
$result = fgets($fh);
where $result will store a line read from a text file. I would like to know if the $result var actually contains the strings read, anyone can help?
string in a variable
Moderator: General Moderators
-
cpetercarter
- Forum Contributor
- Posts: 474
- Joined: Sat Jul 25, 2009 2:00 am
Re: string in a variable
fgets() returns 'false' if the operation fails. So you could use a test like
Code: Select all
if ($!result) echo 'An error message';Re: string in a variable
thx will try itcpetercarter wrote:fgets() returns 'false' if the operation fails. So you could use a test likeCode: Select all
if ($!result) echo 'An error message';
Re: string in a variable
I think it's (!$, not $!) :
No ?
Code: Select all
if (!$result) echo 'An error message';-
cpetercarter
- Forum Contributor
- Posts: 474
- Joined: Sat Jul 25, 2009 2:00 am
Re: string in a variable
Yes, you are right!