mirror of
https://github.com/danielstjules/Stringy.git
synced 2025-08-12 16:24:00 +02:00
Optimize chars() by not repeatedly call length()
This commit is contained in:
@@ -186,7 +186,7 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
|
|||||||
public function chars()
|
public function chars()
|
||||||
{
|
{
|
||||||
$chars = array();
|
$chars = array();
|
||||||
for ($i = 0; $i < $this->length(); $i++) {
|
for ($i = 0, $l = $this->length(); $i < $l; $i++) {
|
||||||
$chars[] = $this->at($i)->str;
|
$chars[] = $this->at($i)->str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user