array (size=10)
‘animal’ => string ‘DOG’ (length=9)
‘age’ => string ’78’ (length=9)
‘name’ => string ‘fido’ (length=4)
‘toy’ => string ‘ball’ (length=22)
0 => string ‘leg’ (length=6) // I only want the numeric into a string
1 => string ‘arm’ (length=11)
2 => string ‘tail’ (length=4)
3 => string ‘eyes’ (length=3)
4 => string ‘ears’ (length=12)
5 => string ‘feet’ (length=3)
1 2 3 4 5 6 7 8 9 |
$metrics = ''; foreach ($mysession as $key => $value) { if (is_numeric($key)) { $metrics .= $value . ','; } } |
Metrics would look like this “leg,arm,tail,eyes,ears,feet,”
Just take off the last character
1 2 3 |
$metrics = substr_replace($metrics ,"",-1); |