How to get the second word from a string in PHP

1 Answer

0 votes
$s = "php java c# python c++";

$arr = explode(' ', $s);

$second_word = $arr[1];

echo $second_word;




/*
run:
  
java
  
*/

 



answered Jul 27, 2020 by avibootz

Related questions

1 answer 126 views
1 answer 174 views
1 answer 102 views
1 answer 206 views
3 answers 173 views
2 answers 131 views
1 answer 136 views
...