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 139 views
1 answer 185 views
1 answer 115 views
1 answer 238 views
3 answers 197 views
2 answers 143 views
1 answer 149 views
...