Forum Moderators: coopster
I'm having a problem with the syntax when there is a ' mid way through the line. Can someone please help
me with the correct syntax.
<?php
// Random HTML Generator
// HTML Array....
$aHTML[0] = 'blah blah';
$aHTML[1] = 'blah blah blah';
$aHTML[2] = 'blah blah blah blah';
$aHTML[3] = 'blah blah's blah';
// Calculate index
$iUpper = sizeof($aHTML) - 1;
$iLower = 0;
$iIndex = rand($iLower, $iUpper);
// Display HTML
echo $aHTML[$iIndex];
?>
The line in question is:
$aHTML[3] = 'blah blah's blah';
I've tried variations of quotes - can't seem to get it to work.
Many thanks for your help in advance
Marc
Add a backslash to the var and then stripslashes on the output!
Or use double quotes arount the array var
> $aHTML[3] = "blah blah's blah";
Hope this helps!