$posts = array( "message" => 'this is a test message' ); foreach ($posts as $post) { echo $post['message']; }
Why does the above code only output the first letter in message? "t".
Thanks!
Array and foreach
$posts = array( "message" => 'this is a test message' ); foreach ($posts as $post) { echo $post['message']; }
Why does the above code only output the first letter in message? "t".
Thanks!
Loop over a flat array
$posts = array( "message" => 'this is a test message' ); foreach ($posts as $post) { echo $post['message']; }
Why does the above code only output the first letter in message? "t".
Post Closed as "Duplicate" by mickmackusa♦ arraysUsers with the arrays badge or a synonym can single-handedly close arrays questions as duplicates and reopen them as needed.