Example #1
0
function get_maximum_upload_size()
{
    $limits['database'] = pow(2, 32) - 1;
    // 4 GB
    /* we trust the sysadmin :)
      ini_get_bytes('memory_limit');
      ini_get_bytes('post_max_size');
      */
    $limits['upload'] = ini_get_bytes('upload_max_filesize');
    return array_min($limits);
}
Example #2
0
 /**
  * Get min value for X axis
  *
  * @return float $value
  */
 public function getXMin()
 {
     return floor(is_null($this->xMin) ? array_min($this->datax) : $this->xMin);
 }
Example #3
0
function shortest_path($start_site)
{
    global $site_info;
    $S = array();
    //array('aa'=>1, 'bb'=>1.1, 'cc'=>3.2)
    $U = array();
    $Un = array_keys($site_info);
    //array(''aa,''bb,''cc)
    unset_key_in_array($Un, $start_site);
    //除开始节点的其他节点
    $last_distance = 0.0;
    $select_node = $start_site;
    while (count($Un) > 0) {
        //遍历
        $nodes = neighbor_intersect($site_info[$select_node]['neighbor'], $Un);
        foreach ($nodes as $item) {
            $new_distance = $last_distance + $item['distance'];
            if (isset($U[$item['name']])) {
                if ($U[$item['name']] > $new_distance) {
                    $U[$item['name']] = $new_distance;
                }
            } else {
                $U[$item['name']] = $new_distance;
            }
        }
        //U集合中取最小值
        $select_node = array_min($U);
        //从U集合中删掉节点加入到S集合中
        $S[$select_node] = $U[$select_node];
        $last_distance = $U[$select_node];
        unset($U[$select_node]);
        unset_key_in_array($Un, $select_node);
    }
    return $S;
    //return  $S[$end_site];
}
Example #4
0
 /**
  * 返回数组中的最小值
  */
 public static function min($array)
 {
     return array_min($array);
 }