Re: [PHP] Perl style chomp()

2007-11-01 Thread Jim Lucas
mike wrote: On 11/1/07, Jim Lucas <[EMAIL PROTECTED]> wrote: I noticed, while perusing the chop() manual page, that some people were giving examples of Perl's chop() and chomp() functions. Comments made about both said the examples were good, but not correct. what about trim(), rtrim() and

Re: [PHP] Perl style chomp()

2007-11-01 Thread mike
On 11/1/07, Jim Lucas <[EMAIL PROTECTED]> wrote: > I noticed, while perusing the chop() manual page, that some people were > giving examples of Perl's > chop() and chomp() functions. Comments made about both said the examples > were good, but not correct. what about trim(), rtrim() and ltrim()

Re: [PHP] Perl style

2005-10-27 Thread Søren Schimkat
Quoting rouvas <[EMAIL PROTECTED]>: > Simpler(?) approach: > > $element5 = current(array_splice(split(',',$csvstring),5,1)); > > This is fun! Indeed... and this looks just fine. A great solution. Thanks. :-) -Søren > > -Stathis > > On Wednesday 26 October 2005 17:08, Jochem Maas wrote: > > S

Re: [PHP] Perl style

2005-10-26 Thread rouvas
Simpler(?) approach: $element5 = current(array_splice(split(',',$csvstring),5,1)); This is fun! -Stathis On Wednesday 26 October 2005 17:08, Jochem Maas wrote: > Sψren Schimkat wrote: > > Hi guys > > > > I would like to convert this .. > > > > > > $tmparray = split(',', $csvstring); > > don't u

Re: [PHP] Perl style

2005-10-26 Thread Jochem Maas
Søren Schimkat wrote: Hi guys I would like to convert this .. $tmparray = split(',', $csvstring); don't use split() here - there is no need for regexp. use explode() instead. $element5 = $tmparray[5]; . to something like this: $element5 = (split(',', $csvstring))[5]; $csvstring = "1,

RE: [PHP] Perl style

2005-10-26 Thread Jay Blanchard
[snip] $tmparray = split(',', $csvstring); $element5 = $tmparray[5]; . to something like this: $element5 = (split(',', $csvstring))[5]; [/snip] The syntax is correct in your first example, AFAIK the PERL syntax you describe cannot be done straight up in PHP unless you write a function to handle