recherche

Maison  >  Questions et réponses  >  le corps du texte

php 中 字符串$a,$a{0} 和 $[0]有什么区别吗?

经常会见到如下的用法
$s='123456';
isset($str{$i}) 
请问php 中 字符串$a,$a{0} 和 $[0]有什么区别吗?

上边有个错误:是$a{0} 和 $a[0]有什么区别吗?


阿神阿神3059 Il y a quelques jours1502

répondre à tous(2)je répondrai

  • 汪汪

    汪汪2016-11-09 16:54:11

    没有什么区别

    répondre
    0
  • 学习ing

    学习ing2016-11-09 16:53:25

    $a{0}大括号跟中括号效果都是一样的把某个字符串变量当成数组处理,
    $a = "abcdefg";
    echo $a{0}; 
    //这代表一个数组元素也就是$a变量的第一个字母a.运行一下你就明白了
    ?>

    répondre
    0
  • Annulerrépondre