How correct and what are the differences

$str='12345'; echo $str[2]; echo $str{2}; echo substr($str, 2, 1); 
  • To address one character through substr is in my opinion a perversion. In the first two cases, there is not much difference. - Stifax
  • $ str [2] is it like part of an array? correct if not right - jcmax

1 answer 1

The first method is simpler and thus better, but in order to judge the difference, you need to smoke the sources of PCP.