Re: echo'ing array contents through reference variable ... why doesn't this work???
| From: | -<[ Rene Brehmer ]>- | Date: | Sat, 23 Nov 2002 15:50:44 +0000 |
| Subject: | Re: echo'ing array contents through reference variable ... why doesn't this work??? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-125731@lists.php.net to get a copy of this message | ||
Hi @ Edwin,
On Fri, 22 Nov 2002 12:34:35 +0900, you wrote about "Re: [PHP] echo'ing
array contents through reference variable ... why doesn't this work???"
something that looked like this:
>> This is my test code:
>>
>> $premieredag =
>>
>> array("2002-11-22","2002-11-29","2002-12-06","2002-12-18");
>> $d20021122 = array("001");
>> $d20021129 = array("002","003","004");
>> $d20021206 = array("005","006","007");
>> $d20021218 = array("008","009");
>>
>> for ($i = 0; $i < count($premieredag); $i++) {
>> echo("<td class=\"date\" width=\"15%\">");
>> echo date("j. F Y",strtotime($premieredag[$i]));
>> echo ("</td><td> </td>\n");
>> echo("</tr><tr>\n");
>> $pdag = "d".str_replace("-","",$premieredag[$i]);
>> for ($n = 0; $i < count($$pdag); $n++) {
>
>It seems like $i would always be TRUE here, no?
>
>Just guessing...
DOH! Of course ... totally missed that ... thx
But then ... why doesn't it pull the data correctly from the array???
Now I just get this:
<td class="date" width="15%">22. November
2002</td><td> </td>
</tr><tr>
<td colspan="2" class="filmtxt"></td>
</tr><tr>
<td class="date" width="15%">29. November
2002</td><td> </td>
</tr><tr>
<td colspan="2" class="filmtxt"></td>
</tr><tr>
<td colspan="2" class="filmtxt"></td>
</tr><tr>
<td colspan="2" class="filmtxt"></td>
</tr><tr>
<td class="date" width="15%">6. December
2002</td><td> </td>
</tr><tr>
<td colspan="2" class="filmtxt"></td>
</tr><tr>
<td colspan="2" class="filmtxt"></td>
</tr><tr>
<td colspan="2" class="filmtxt"></td>
</tr><tr>
<td class="date" width="15%">18. December
2002</td><td> </td>
</tr><tr>
<td colspan="2" class="filmtxt"></td>
</tr><tr>
<td colspan="2" class="filmtxt"></td>
</tr><tr>
Shouldn't
echo($$pdag[$n]);
be able to pull the string contents of the array? Or is there some extra
needed when using referenced variable?
The manual, atleast haven't found it, doesn't say anything about using
referenced variables at all, and definetely not with arrays...