Skip to main content
More indicative title
Source Link
mickmackusa
  • 49.2k
  • 13
  • 98
  • 165

Array and foreach 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".

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 arrays
Source Link
Broga
Broga

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!