0
Array ( 
 [0] => Array ( 
 [0] => 21 
 [SLOTID] => 21
 ) 
 [1] => Array ( 
 [0] => 4 
 [SLOTID] => 4 
 ) 
)

I want to create a new string from this array like:21,4.

mickmackusa
49k13 gold badges97 silver badges163 bronze badges
asked Apr 6, 2012 at 20:11
1
  • 1
    Use implode Commented Apr 6, 2012 at 20:13

2 Answers 2

1
$str = $arr[0][0] . ',' . $arr[1][0];
answered Apr 6, 2012 at 20:16

1 Comment

@AwladLiton What do you want to do when you have more values? Create more strings, or modify that one string to be longer, or is this good enough?
0

Here is the standard way to do this

implode(",",$arr)

answered Apr 6, 2012 at 22:38

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.