Get specific character from string in PHP
get specific word from string php
$myString = "input/name/something";
$strArray = explode('/',$myString);
$name = $strArray[1];
$something = $strArray[2];
Use the PHP substr() function
The PHP substr() function can be used to get the substring i.e. the part of a string from a string. This function takes the start and length parameters to return the portion of string.
<?php
$str = "Hello World!";
echo substr($str, 0, 5); // Outputs: Hello
echo substr($str, 0, -7); // Outputs: Hello
echo substr($str, 0); // Outputs: Hello World!
echo substr($str, -6, 5); // Outputs: World
echo substr($str, -6); // Outputs: World!
echo substr($str, -12); // Outputs: Hello World!
?>