Re: substr/array_slice in []

From: Date: Tue, 09 Oct 2007 05:33:26 +0000
Subject: Re: substr/array_slice in []
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-32708@lists.php.net to get a copy of this message
On 09.10.2007 06:32, Andrei Zmievski wrote: > I will use an example: > > $foo = substr($bar, 0, 5) . "-" . substr($bar, 5); > > or > > $foo = $bar[:5] . "-" . $bar[5:]; > > I would argue that the second line is hardly more cryptic than the > first one. How come? It looks like you're reading $bar[':5'], but forgot the quotes. On the other side, what could be easier than a function call? > And if we were concerned that concerned about duplicate > functionality, we probably wouldn't have SimpleXML and similar things. Mistakes done in the past do not mean we should continue to do them in the future. -- Wbr, Antony Dovgal

« previous php.internals (#32708) next »