dongtui4038 2018-04-24 10:44
浏览 121
已采纳

在字符串php上插入数组值

I'm getting an error trying to make this

$array = array("text");

echo "text $array['0']";

it's possible to make it shis way instead concatenate

echo "text ".$array['0'];
  • 写回答

2条回答 默认 最新

  • dongrong5189 2018-04-24 10:48
    关注

    1. You need to remove ' around 0

    echo "text $array[0]";
    

    Output:- https://eval.in/993458

    2.Or enclose array element with {}

    echo "text {$array['0']}";
    

    Output:-https://eval.in/993460

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?