How to combine strings inside foreach into single string PHP

后端 未结 8 1377
傲寒
傲寒 2020-12-11 04:35

I have code like this

$word = \'foo\';
$char_buff = str_split($word);

foreach ($char_buff as $chars){
    echo var_dump($chars);
}

The out

8条回答
  •  無奈伤痛
    2020-12-11 05:18

    str_split() converts a string to an array. There's no need to use this function if you want to keep the whole word.

提交回复
热议问题