Search
Generic filters
Exact matches only

Add only Numeric parts of array to a string

23rd January 2015

Php - Arrays

php codehaven

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)

Metrics would look like this “leg,arm,tail,eyes,ears,feet,”

Just take off the last character

Was this code snippet helpful?

Comment on this Code Snippet?