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.

1
  • 1
    Use implode Commented Apr 6, 2012 at 20:13

2 Answers 2

1
$str = $arr[0][0] . ',' . $arr[1][0];
1
  • 1
    @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? Commented Apr 6, 2012 at 23:42
0

Here is the standard way to do this

implode(",",$arr)

Your Answer

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.