str::before($string, $before)

Returns the beginning of a string before the given character

  • $string (string)
  • $before (string)
    Character(s) to stop before
  • return (string)
    The beginning of the string

Example

<?php

echo str::before('string', 'r');
// output: st