Forum Moderators: coopster

Message Too Old, No Replies

PHP Implode File Question

         

rjbearcan

4:30 pm on Nov 22, 2005 (gmt 0)

10+ Year Member



Can I not use a variable with implode such as
implode('', file('$url'));

as opposed to

implode('', file('http://www.example.com/'));

When I pass the variable, nothing comes up, yet if I pass the actual url, it works.

coopster

4:32 pm on Nov 22, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Yes, but you can't have it in single quotation marks. Either double quotation marks or none at all.

Strings [php.net]

rjbearcan

4:38 pm on Nov 22, 2005 (gmt 0)

10+ Year Member



Even when I add the double quotations or no quotations at all, nothing still comes up. The url is in the format:

http://example.com?a=$b

dreamcatcher

5:37 pm on Nov 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you echoed the $url variable to see if its populated?

coopster

5:44 pm on Nov 22, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



There shouldn't be any difference. I am referring to the parsing of the '$url' which is not happening in the file() function because of the single quotation marks. Are we indeed discussing the same thing? Because it should work just as if you were keying the url into the file() function.

Dump the $url variable to your browser to make sure you have the url value there ...

rjbearcan

7:31 pm on Nov 22, 2005 (gmt 0)

10+ Year Member



I got it fixed. I was missing a semicolon from the previous line. Thanks for your help!