NYCPHP Meetup

[nycphp-talk] fwrite confusion

Tim Lieberman tim_lists at o2group.com
Sun Nov 16 20:02:24 EST 2008


String interpolation doesn't like array dereferences.

Try:

"$blah {$clean['name']} $blah"

or some variation of:

$blan . ' ' . $clean['name'] . ' ' . $blah

-Tim

On Nov 16, 2008, at 7:51 PM, Leam Hall wrote:

> yeah...yeah...another noob question. Happy Sunday evening!  ;)
>
> The variable $name and $clean['name'] contain the same text. I'm using
> Chris' suggestions while cleaning up old code. In this case the  
> variable
> contains space delimited alnum with an ending space. "Test of several
> ideas "
>
> 	fwrite($file, "$blah $name $blah");
>
> works but
>
> 	fwrite($file, "$blah $clean['name'] $blah" )
>
> does not, producing:
>
> Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE,
> expecting T_STRING or T_VARIABLE or T_NUM_STRING
>
> Even trying to just echo "$clean['name']" fails.
>
> Suggestions on what to read up on?
>
> Leam
>
>
> _______________________________________________
> New York PHP User Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/show_participation.php




More information about the talk mailing list