Placing string variables within array fucntion
Posted: Mon May 10, 2010 5:05 pm
Hi - i think there is probably something simple I'm overlooking...
I need to create the following line of php to work within the confines of a more complex project where I have little flexibility about this particular line:
$item = array("sample1"=>"100", "sample2"=>"200", "sample3"=>"300");
Instead of having the text of this array function 'hard-coded', I am trying to fill this array function with a dynamic string variable which I've CURL'd from another page; the result of my CURL is a perfectly-formatted text-string that would fit verbatim into my required array function format:
$resultcurl = ' "sample1"=>"100", "sample2"=>"200", "sample3"=>"300" ' ;
and so i'm trying to get a final working code to look something like:
$item = array($resultcurl);
However, the array function doesn't simply substitute $resultcurl with its associated formatted textstring...
So long story short, is there a way to get the array() function to read and process the textstring as represented by my $resultcurl variable?
many thanks,
-jason fisher
I need to create the following line of php to work within the confines of a more complex project where I have little flexibility about this particular line:
$item = array("sample1"=>"100", "sample2"=>"200", "sample3"=>"300");
Instead of having the text of this array function 'hard-coded', I am trying to fill this array function with a dynamic string variable which I've CURL'd from another page; the result of my CURL is a perfectly-formatted text-string that would fit verbatim into my required array function format:
$resultcurl = ' "sample1"=>"100", "sample2"=>"200", "sample3"=>"300" ' ;
and so i'm trying to get a final working code to look something like:
$item = array($resultcurl);
However, the array function doesn't simply substitute $resultcurl with its associated formatted textstring...
So long story short, is there a way to get the array() function to read and process the textstring as represented by my $resultcurl variable?
many thanks,
-jason fisher