1
0
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:
Daniel St. Jules
2015-01-05 12:08:58 -05:00

View File

@@ -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;
}