Variables in fwrite function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
becky-atlanta
Forum Commoner
Posts: 74
Joined: Thu Feb 26, 2009 6:26 pm
Location: Atlanta, GA

Variables in fwrite function

Post by becky-atlanta »

$i['qty'] is a variable that I want to write to a file. The following line gives me an error or unexpected ".".

fwrite($fx, .$i['qty'].);

What is the correct syntax for this?
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: Variables in fwrite function

Post by Mark Baker »

The correct syntax is without the dots that the error tells you you shouldn't have

Code: Select all

fwrite($fx,  $i['qty']);
User avatar
becky-atlanta
Forum Commoner
Posts: 74
Joined: Thu Feb 26, 2009 6:26 pm
Location: Atlanta, GA

Re: Variables in fwrite function

Post by becky-atlanta »

Thanks, Mark! That works. :D
Post Reply