mirror of
https://github.com/danielstjules/Stringy.git
synced 2025-08-12 08:14:06 +02:00
Merge pull request #60 from vlakoff/optimize
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()
|
||||
{
|
||||
$chars = array();
|
||||
for ($i = 0; $i < $this->length(); $i++) {
|
||||
for ($i = 0, $l = $this->length(); $i < $l; $i++) {
|
||||
$chars[] = $this->at($i)->str;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user