If I have a line like this:
$myString = "input/name/something";
How can I get an echo ? Each line looks like this, except for this name, and something might be different.
so the only thing you know is that:
$strArray = explode('/',$myString); $name = $strArray[1]; $something = $strArray[2];
If you only need "name"
list(, $name, ) = explode('/', $myString); echo "name is '$name'";
If you want everything then
list($input, $name, $something) = explode('/', $myString);
Try the following:
$parts = explode('/', $myString); echo $parts[1];
This will strip your string with forward slashes and return an array of parts. Part 1 is the name.
use a function explode('/') to get an array array('input', 'name', 'something') . I'm not sure if you mean you need to determine which element you need, but if it's only the second of three then use that.
explode('/')
array('input', 'name', 'something')