本文整理汇总了PHP中complex_array::sort_array方法的典型用法代码示例。如果您正苦于以下问题:PHP complex_array::sort_array方法的具体用法?PHP complex_array::sort_array怎么用?PHP complex_array::sort_array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类complex_array
的用法示例。
在下文中一共展示了complex_array::sort_array方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_shipping_options
function get_shipping_options($shipping_configuration)
{
if ($this->cache_result) {
if (($options = $this->_get_cached_options($shipping_configuration)) !== false) {
return $options;
}
}
if (!($options = $this->_do_get_shipping_options($shipping_configuration))) {
return array();
}
$options = complex_array::sort_array($options, array('price' => 'ASC'));
if ($this->cache_result) {
$this->_save_cached_options($shipping_configuration, $options);
}
return $options;
}
示例2: array
function _do_sort(& $tree_array, & $sorted_tree_array, $sort_params, $parent_id, $id_hash, $parent_hash)
{
$children = array();
foreach($tree_array as $index => $item)
{
if($item[$parent_hash] == $parent_id)
{
$children[] = $item;
unset($tree_array[$index]);
}
}
if(!($count = sizeof($children)))
return;
$children = complex_array :: sort_array($children, $sort_params);
if(!$sorted_tree_array)
{
$sorted_tree_array = $children;
}
else
{
$ids = complex_array :: get_column_values($id_hash, $sorted_tree_array);
$offset = array_search($parent_id, $ids) + 1;
array_splice($sorted_tree_array, $offset, 0, $children);
}
for($i=0; $i < $count; $i++)
{
tree_sorter :: _do_sort($tree_array, $sorted_tree_array, $sort_params, $children[$i][$id_hash], $id_hash, $parent_hash);
}
}
示例3: array
function _check_proper_nesting($nodes, $line='')
{
$this->assertEqual(complex_array :: sort_array($nodes, array('path' => 'ASC')),
$nodes);
$path = complex_array :: get_min_column_value('path', $nodes, $index);
$parent_paths[] = $this->_get_parent_path($path);
$counter = 0;
foreach($nodes as $id => $node)
{
$parent_path = $this->_get_parent_path($node['path']);
$this->assertTrue(in_array($parent_path, $parent_paths),
'path is improperly nested: ' . $node['path'] . ' , expected parent not found: ' . $parent_path . ' at line: ' . $line);
$parent_paths[] = $node['path'];
}
}