Hello

I surely this is easy & I'm just overlooking something...

Basically, I'm wanting to copy $event into $html, but have all the values within the nested array escaped with htmlentities().

The problem must be this line:
$v2 = htmlentities($v2, ENT_QUOTES, 'UTF-8');

...but I have no idea how to fix it!

Is anyone able to point me in the right direction?

Thanks
Tim


Here's the code:

<?php

# Sample array data
$event[0]['title'] = '"Tea & Biscuts" Evening';
$event[0]['desc']  = 'At my house.';
$event[1]['title'] = '"Cheese & Wine" Lunch';
$event[1]['desc']  = 'At yours!';

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

echo '<h2>html</h2><pre>';
print_r($html);
echo '</pre>';
exit;

?>


_______________________________________________
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