I am trying to build a test to explode each string from an array while doing foreach loop.
Can someone show me what I'm doing wrong with the array and construction of the statement. All I get in return is 'array'.
More info in case you have input on how this whole thing might be handled better:
The real array is coming from POST data which are comma delimited strings. I need to explode the string at the '@' and assign to 2 variables. These variables then become Cell values in a PDF doc that this code is for (using TCPDF).
So, I need to loop through the array, each time assigning the 2 resulting variables to a line in the pdf file.
If you can just help me with the test that would be a HUGE assist!
Thanks
Can someone show me what I'm doing wrong with the array and construction of the statement. All I get in return is 'array'.
Code:
$posted = array('text1@url1', 'text2@url2', 'text3@url3');
Foreach($posted as $astring)
{
$astring = explode("@", $posted);
$adesc = $astring[0];
$aurl = $astring[1];
echo $adesc, ' then ', $aurl;
}
More info in case you have input on how this whole thing might be handled better:
The real array is coming from POST data which are comma delimited strings. I need to explode the string at the '@' and assign to 2 variables. These variables then become Cell values in a PDF doc that this code is for (using TCPDF).
So, I need to loop through the array, each time assigning the 2 resulting variables to a line in the pdf file.
If you can just help me with the test that would be a HUGE assist!
Thanks