Skip to content

Commit 33a0447

Browse files
committed
'ltrim' is faster than 'trim'
1 parent a9a1cf1 commit 33a0447

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/EnumSet.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public function rewind()
202202
*/
203203
private function doRewindBin()
204204
{
205-
if (trim($this->bitset, "\0") !== '') {
205+
if (ltrim($this->bitset, "\0") !== '') {
206206
$this->ordinal = -1;
207207
$this->next();
208208
} else {
@@ -620,7 +620,7 @@ private function doSetBinaryBitsetLeBin($bitset)
620620
// add "\0" if the given bitset is not long enough
621621
$bitset .= str_repeat("\0", $size - $sizeIn);
622622
} elseif ($sizeIn > $size) {
623-
if (trim(substr($bitset, $size), "\0") !== '') {
623+
if (ltrim(substr($bitset, $size), "\0") !== '') {
624624
throw new InvalidArgumentException('Out-Of-Range bits detected');
625625
}
626626
$bitset = substr($bitset, 0, $size);

0 commit comments

Comments
 (0)