how get elements before an specific character in php code example Example: php get string before character $arr = explode("/", $string, 2); $first = $arr[0];