I have some data in an associative array and when I pass each element of the array to a variable, it only gets the first character of the string.
For example:
array (size=5)
'data' =>
array (size=14)
'number' => string '321335' (length=6)
'text' => string 'abcde' (length=5)
$number = $commentData['data']['number'];
$text = $commentData['data']['text'];
echo $text;
// Output: a
echo $number;
// Output: 3
I expected to return all string on variable. I tried:
echo $commentData['data']['number'];
// Output: a
echo $commentData['data']['text'];
// Output: 3
var_dump($commentData);?var_export($commentData);instead, then the output will be re-usable as PHP code, so we can test it easily and make examples / answers without having to re-key it. Thanks. php.net/manual/en/function.var-export.php . Based on what you've shown so far, we don't appear to have a minimal reproducible example of the issue. What you are stating, does not seem to be possible, based on the (admittedly limited) data provided.