How to get the N word from a string in PHP

1 Answer

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

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

$N = 3;
$second_word = $arr[$N - 1];

echo $second_word;




/*
run:
  
c#
  
*/

 



answered Jul 27, 2020 by avibootz
...