<?php
function by_tag($things) {
$sorted = array();
foreach ($things as $thing) {
$thing['title'] = "new title"; # this works!
$thing['size'] = 100; # this doesn't work, it keeps the old value.
array_push($sorted, $thing);
}
return $sorted;
}
$unsorted = array(
array('foo' => 'bar', 'size' => 1, 'title' => 'changeme1'),
array('foo' => 'bar', 'size' => 2, 'title' => 'changeme2'),
array('foo' => 'bar', 'size' => 3, 'title' => 'changeme3'),
array('foo' => 'bar', 'size' => 4, 'title' => 'changeme4'),
array('foo' => 'bar', 'size' => 5, 'title' => 'changeme5')
);
var_dump(by_tag($unsorted));
preferences:
35.53 ms | 402 KiB | 5 Q