Loop through variables with common name

前端 未结 4 1915
名媛妹妹
名媛妹妹 2020-12-19 16:44

At first glance I think you can get what I\'m trying to do. I want to loop though variables with the same name but with a numerical prefix. I also had some confusion about t

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-19 17:29

    Try ${"hello" . $counter}

    $a = "hell";
    $b = "o";
    $hello = "world";
    echo ${$a . $b};
    
    // output: world
    

提交回复
热议问题