The message should say:

Perhaps the error lies in 

for ($n = 0; $i < count($$pdag); $n++) {

You have $$pdag instead of $pdag.  You also have it lower down in the code.

-----Original Message-----
From: Van Andel, Robert 
Sent: Thursday, November 21, 2002 1:10 PM
To: -<[ Rene Brehmer ]>-; [EMAIL PROTECTED]
Subject: RE: [PHP] echo'ing array contents through reference variable
... why doesn't this work???


Perhaps the error lies in 

for ($n = 0; $i < count($$pdag); $n++) {

You have $$pdag instead of $$pdag.  You also have it lower down in the code.

Robbert van Andel 

-----Original Message-----
From: -<[ Rene Brehmer ]>- [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 21, 2002 1:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP] echo'ing array contents through reference variable ...
why doesn't this work???


I've run into something I don't understand...

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>&nbsp;</td>\n");
    echo("</tr><tr>\n");
    $pdag = "d".str_replace("-","",$premieredag[$i]);
    for ($n = 0; $i < count($$pdag); $n++) {
      echo("<td colspan=\"2\" class=\"filmtxt\">");
      echo($$pdag[$n]);
      echo("</td>\n");
      echo("</tr><tr>\n");
    }
  }

When it runs, it goes beserk, and gives me this:

<td class="date" width="15%">22. November 2002</td><td>&nbsp;</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 colspan="2" class="filmtxt"></td>
</tr><tr>
<td colspan="2" class="filmtxt"></td>
</tr><tr>

...and so on ...

It never ends ... and I get no error messages ... 

So I must conclude that count($$pdag) does not work on reference
variables... what can you do about that? The arrays that $$pdag refers to
are variable length (or will be in the final code), so I really need to be
able to do it this way ...

Any other way to find the top of an array ???

Rene


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


 "The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers." 




 "The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers." 


Reply via email to