I have code like this
$word = \'foo\';
$char_buff = str_split($word);
foreach ($char_buff as $chars){
echo var_dump($chars);
}
The out
I'm going to assume that you have a good reason for splitting it up, only to put it back together again:
$word = 'foo';
$result = "";
$char_buff = str_split($word);
foreach ($char_buff as $char){
$result .= $char;
}
echo var_dump($result);
Which outputs the following:
string(3) "foo"
Kind of strange to split a string, and then glue it together again, but here goes:
$word='foo'
$char_buff = str_split($word);
// this is what is missing, you have to define a variable first
$newword = "";
foreach ($char_buff as $chars){
$newword .= $chars;
}
echo var_dump($newword);