[ create a new paste ] login | about

Link: http://codepad.org/x3Z1zLjz    [ raw code | output | fork ]

PHP, pasted on Aug 23:
1
2
3
4
5
6
7
8
9
10
11
12
<?php

$array1 = array(
0 => "bar",
"cat" => "foo",);
foreach($array1 as $key => $value)
{
 $array1[$value] = $value;
 unset($array1[$key]);
}

var_dump($array1);


Output:
1
2
3
4
5
6
array(2) {
  ["bar"]=>
  string(3) "bar"
  ["foo"]=>
  string(3) "foo"
}


Create a new paste based on this one


Comments: