@@ 414-423 (lines=10) @@ | ||
411 | * @return string |
|
412 | * @author Aurimas Niekis <[email protected]> |
|
413 | */ |
|
414 | function left($string, $n) |
|
415 | { |
|
416 | $start = 0; |
|
417 | if ($n < 0) { |
|
418 | $start = $n; |
|
419 | $n = -$n; |
|
420 | } |
|
421 | ||
422 | return substr($string, $start, $n); |
|
423 | } |
|
424 | ||
425 | /** |
|
426 | * Return the length of a string |
|
@@ 571-580 (lines=10) @@ | ||
568 | * @return string |
|
569 | * @author Aurimas Niekis <[email protected]> |
|
570 | */ |
|
571 | function right($string, $n) |
|
572 | { |
|
573 | $start = -$n; |
|
574 | if ($n < 0) { |
|
575 | $start = 0; |
|
576 | $n = -$n; |
|
577 | } |
|
578 | ||
579 | return substr($string, $start, $n); |
|
580 | } |
|
581 | ||
582 | ||
583 | /** |