On 12/21/2012 4:38 PM, Tedd Sperling wrote:
Never realized that you could address a string as an array of chars,
which you are doing. Could that be the issue? Or did I learn something
new? Or should you have used substr to remove that last char?
I just ran into something I have never had a problem with before.
Here's the code:
--- start of code
$topic = '';
while($row = mysql_fetch_array($result)) // pulling stuff from a
$topic .= $row['category'] . '~'; // adding a delimiter
$str_length = strlen($topic);
if($topic[$str_length-1] == '~')
$topic[$str_length-1] = ''; // remove last ~ delimiter
echo($topic); // this result is used in an AJAX script
--- end of code
in Safari and FireFox, everything is OK.
But when the result is displayed on IE, the "end" of the string causes problems
Now, I realize that I have altered the string by removing the last character
and I have not shortened the string to reflect that, but I never thought it
would cause any problems.
Would someone please enlighten me as to why this would work in Safari, FireFox,
but not in IE?
PS: Also, please don't beg the answer by saying "It's IE -- what do you
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php