PHP - get certain word from string

后端 未结 4 1091
陌清茗
陌清茗 2021-01-15 04:47

If i have a string like this:

$myString = \"input/name/something\";

How can i get the name to be echoed? Every string look

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-15 05:29

    If you only need "name"

    list(, $name, ) = explode('/', $myString);
    echo "name is '$name'";
    

    If you want all, then

    list($input, $name, $something) = explode('/', $myString);
    

提交回复
热议问题