Just remember there are some "gotchas" when using foreach with references. If you do this, remember to unset the variable after the loop so you don't accidentally overwrite anything.

Cliff Hirsch wrote:
On 7/23/07 8:47 AM, "Tim B" <[EMAIL PROTECTED]> wrote:

Here's the code:
# Escape for output into html
foreach ($event as $v1)
{
    foreach ($v1 as $v2)
    {
       $v2 = htmlentities($v2, ENT_QUOTES, 'UTF-8');
       echo "{$v2}<br>";

V1 and V2 need to be references. See online php manual

foreach ($event as &$v1)
{
    foreach ($v1 as &$v2)




_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php



--

Thanks!
- Brian Dailey
Software Developer
New York, NY
www.dailytechnology.net
begin:vcard
fn:Brian Dailey
n:Dailey;Brian
org:;Department of Geekery
adr;dom:;;;New York;NY
email;internet:[EMAIL PROTECTED]
title:Senior Software Engineer
tel;home:423 506 0349
x-mozilla-html:FALSE
url:http://dailytechnology.net
version:2.1
end:vcard

_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to