Jump to content

[SOLVED] foreach with commas


timmah1

Recommended Posts

How can I separate a foreach statement with commas?

 

I'm trying to show temperatures from the database for each user, right now, there are 2 in there

It shows the temps, but together

99.697.3

 

I need it to show like

99.6, 97.3

 

If I just echo the value with a comma, it puts one on the end as well

<?php
$temps[$charts['temp']] =  $charts['username'];
				} 
				foreach ($temps as $f)
				//$temp = implode(' ', $f);
				echo $f.",";
?>

 

How is this accomplished? I tried split(), but either I didn't do it right, or it just don't work

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/141479-solved-foreach-with-commas/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.