-2

How i can replace the array values in php

 Array ([0] => Array ([ss] => k))

into

 array("0" => array ("ss" => "k"));
4
  • 2
    Why would you want that? Commented May 22, 2013 at 10:01
  • Ref : php.net/manual/en/language.types.array.php Commented May 22, 2013 at 10:01
  • 3
    Hi welcome to Stackoverflow.com, please go through the existing questions and answers, there's a huge probability that you will find your answer without posting any new question. Commented May 22, 2013 at 10:02
  • This is just a hunch, since your question is not very clear, but are you looking for the var_export() function? Commented May 22, 2013 at 10:04

1 Answer 1

3

You have to write you own function to output the format you like.

While the nearest solution with build-in function is var_export.

$array = array(array('ss' => 'k'));
var_export($array);

Output:

array (
  0 =>
  array (
    'ss' => 'k',
  ),
)
Sign up to request clarification or add additional context in comments.

1 Comment

sidenote: if the OP wants to further manipulate the output, he can save the output of var_export by passing true in 2nd parameter of the function, i.e. $output = var_export($array, true);. Then, OP can play with $output.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.