Re: [PHP] Strange string stuff -- maybe everything is ending...

2012-12-22 Thread Stefan Wixfort
On 22.12.2012 00:31, Bastien wrote: On 2012-12-21, at 5:05 PM, Ken Robinson wrote: A much easier way to do this would be to use a temporary array and then explode: $tmp = array(); while($row = mysql_fetch_array($result)) // pulling stuff from a database {

Re: [PHP] Strange string stuff -- maybe everything is ending...

2012-12-22 Thread Bastien
Bastien Koert On 2012-12-22, at 11:50 AM, Tedd Sperling wrote: > On Dec 22, 2012, at 7:58 AM, tamouse mailing lists > wrote: > >> A bit of an example to shed a little light? >> -snip- >> Not knowing IE really at all, nor it's JS engine, it's entirely >> possible that a null character in a s

Re: [PHP] Strange string stuff -- maybe everything is ending...

2012-12-22 Thread Tedd Sperling
On Dec 22, 2012, at 7:58 AM, tamouse mailing lists wrote: > A bit of an example to shed a little light? > -snip- > Not knowing IE really at all, nor it's JS engine, it's entirely > possible that a null character in a string causes it to have problems. That's the explanation I was looking for --

Re: [PHP] Strange string stuff -- maybe everything is ending...

2012-12-22 Thread Tedd Sperling
On Dec 21, 2012, at 8:06 PM, Jim Giner wrote: >> That actually makes sense tho. Afterall, a string is truly only one memory >> allocation whereas array elements are basically multiple vars having the >> same name. So - how can you unset one char in a string? It depends upon the language -- wh

Re: [PHP] Strange string stuff -- maybe everything is ending...

2012-12-22 Thread Tedd Sperling
On Dec 21, 2012, at 5:27 PM, Jim Giner wrote: > From what I do know, there shouldn't be an a[4]. > In any case, let's assume that there is a bug in the string logic that you're > using. Why not just use substr? > > $topic = substr($topic,0,-1); and On Dec 21, 2012, at 6:10 PM, Nathan Nobbe w

Re: [PHP] Strange string stuff -- maybe everything is ending...

2012-12-22 Thread Jim Giner
On 12/22/2012 11:29 AM, Tedd Sperling wrote: On Dec 21, 2012, at 5:20 PM, Volmar Machado wrote: What is the result in FF? And on IE? (the echoed string) That's the problem, it's different. If the last char in a string is set to null, then it causes JavaScript routines running under IE to b

Re: [PHP] Strange string stuff -- maybe everything is ending...

2012-12-22 Thread Tedd Sperling
On Dec 21, 2012, at 5:20 PM, Volmar Machado wrote: > What is the result in FF? And on IE? (the echoed string) That's the problem, it's different. If the last char in a string is set to null, then it causes JavaScript routines running under IE to behave differently than the exact same JavaScrip

Re: [PHP] Strange string stuff -- maybe everything is ending...

2012-12-22 Thread tamouse mailing lists
On Fri, Dec 21, 2012 at 7:06 PM, Jim Giner wrote: > That actually makes sense tho. Afterall, a string is truly only one memory > allocation whereas array elements are basically multiple vars having the > same name. So - how can you unset one char in a string? That actually depends on what you m

Re: [PHP] Strange string stuff -- maybe everything is ending...

2012-12-21 Thread Jim Giner
On 12/21/2012 7:59 PM, Nathan Nobbe wrote: On Fri, Dec 21, 2012 at 4:10 PM, Nathan Nobbe wrote: On Fri, Dec 21, 2012 at 3:27 PM, Jim Giner wrote: On 12/21/2012 5:16 PM, Tedd Sperling wrote: On Dec 21, 2012, at 4:58 PM, Jim Giner wrote: Never realized that you could address a string

Re: [PHP] Strange string stuff -- maybe everything is ending...

2012-12-21 Thread Nathan Nobbe
On Fri, Dec 21, 2012 at 4:10 PM, Nathan Nobbe wrote: > > > On Fri, Dec 21, 2012 at 3:27 PM, Jim Giner > wrote: > >> On 12/21/2012 5:16 PM, Tedd Sperling wrote: >> >>> On Dec 21, 2012, at 4:58 PM, Jim Giner >>> wrote: >>> > Never realized that you could address a string as an array of c

Re: [PHP] Strange string stuff -- maybe everything is ending...

2012-12-21 Thread Bastien
On 2012-12-21, at 5:05 PM, Ken Robinson wrote: > A much easier way to do this would be to use a temporary array and then > explode: > > $tmp = array(); >while($row = mysql_fetch_array($result)) // pulling stuff from a > database >{ >$tmp[] = $row['categ

Re: [PHP] Strange string stuff -- maybe everything is ending...

2012-12-21 Thread Louis Colman
Think that PHP inherited this from the C-language. The C-language inherited this from good old assembler :-) Index of the array is the offset from the starting-address of the string. Suppose the "$a" starts at address 1000 than $a[0] is at 1000 + 0, $a[1] is at 1000 + 1 $a[2] is at 1000 + 2 etc..

Re: [PHP] Strange string stuff -- maybe everything is ending...

2012-12-21 Thread Jim Giner
On 12/21/2012 6:10 PM, Nathan Nobbe wrote: On Fri, Dec 21, 2012 at 3:27 PM, Jim Giner wrote: Neat idea Tedd, but judging by a quick test, I don't think changing the value of the string is entirely supported though that notation. php > $str = 'blah'; php > $str[3] = ''; php > echo $str . PHP_

Re: [PHP] Strange string stuff -- maybe everything is ending...

2012-12-21 Thread Nathan Nobbe
On Fri, Dec 21, 2012 at 3:27 PM, Jim Giner wrote: > On 12/21/2012 5:16 PM, Tedd Sperling wrote: > >> On Dec 21, 2012, at 4:58 PM, Jim Giner >> 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 lear

Re: [PHP] Strange string stuff -- maybe everything is ending...

2012-12-21 Thread Jim Giner
On 12/21/2012 5:16 PM, Tedd Sperling wrote: On Dec 21, 2012, at 4:58 PM, Jim Giner 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 ch

Re: [PHP] Strange string stuff -- maybe everything is ending...

2012-12-21 Thread Ken Robinson
Can you post the javascript that's causing the problem? And, yes, it's IE, what did you expect... :-) Ken At 05:10 PM 12/21/2012, Tedd Sperling wrote: On Dec 21, 2012, at 5:05 PM, Ken Robinson wrote > A much easier way to do this would be to use a temporary array and then explode: > > $tmp

Re: [PHP] Strange string stuff -- maybe everything is ending...

2012-12-21 Thread Tedd Sperling
On Dec 21, 2012, at 4:58 PM, Jim Giner 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? Jim: I guess you learned somethin

Re: [PHP] Strange string stuff -- maybe everything is ending...

2012-12-21 Thread Tedd Sperling
On Dec 21, 2012, at 5:05 PM, Ken Robinson wrote > A much easier way to do this would be to use a temporary array and then > explode: > > $tmp = array(); >while($row = mysql_fetch_array($result)) // pulling stuff from a > database >{ >$tmp[] = $row['catego

Re: [PHP] Strange string stuff -- maybe everything is ending...

2012-12-21 Thread Ken Robinson
A much easier way to do this would be to use a temporary array and then explode: $tmp = array(); while($row = mysql_fetch_array($result)) // pulling stuff from a database { $tmp[] = $row['category']; } $topic = explode('~',$t

[PHP] Strange string stuff -- maybe everything is ending...

2012-12-21 Thread Tedd Sperling
Hi gang; 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 database { $topic .= $row['category'] . '~'; // add