get string before character php code example
Example 1: php remove last character from string
$hell = substr('hello', 0, -1);
Example 2: get the string after a character in php
$data = "123_String";
$whatIWant = substr($data, strpos($data, "_") + 1);
echo $whatIWant;
Example 3: javascript get first character of string
var str="Hello Folks!"
var firstStringChar = str.charAt(0); //H
Example 4: php get string before character
$arr = explode("/", $string, 2);
$first = $arr[0];