get string before a character php code example Example: php get string before character Click to copy$arr = explode("/", $string, 2); $first = $arr[0];