当前位置: 首页>>代码示例>>PHP>>正文


PHP rsort函数代码示例

本文整理汇总了PHP中rsort函数的典型用法代码示例。如果您正苦于以下问题:PHP rsort函数的具体用法?PHP rsort怎么用?PHP rsort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rsort函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test

 public function test(CqmPatient $patient, $beginDate, $endDate)
 {
     // See if user has been a tobacco user before or simultaneosly to the encounter within two years (24 months)
     $date_array = array();
     foreach ($this->getApplicableEncounters() as $encType) {
         $dates = Helper::fetchEncounterDates($encType, $patient, $beginDate, $endDate);
         $date_array = array_merge($date_array, $dates);
     }
     // sort array to get the most recent encounter first
     $date_array = array_unique($date_array);
     rsort($date_array);
     // go through each unique date from most recent
     foreach ($date_array as $date) {
         // encounters time stamp is always 00:00:00, so change it to 23:59:59 or 00:00:00 as applicable
         $date = date('Y-m-d 23:59:59', strtotime($date));
         $beginMinus24Months = strtotime('-24 month', strtotime($date));
         $beginMinus24Months = date('Y-m-d 00:00:00', $beginMinus24Months);
         // this is basically a check to see if the patient is an reported as an active smoker on their last encounter
         if (Helper::check(ClinicalType::CHARACTERISTIC, Characteristic::TOBACCO_USER, $patient, $beginMinus24Months, $date)) {
             return true;
         } else {
             if (Helper::check(ClinicalType::CHARACTERISTIC, Characteristic::TOBACCO_NON_USER, $patient, $beginMinus24Months, $date)) {
                 return false;
             } else {
                 // nothing reported during this date period, so move on to next encounter
             }
         }
     }
     return false;
 }
开发者ID:katopenzz,项目名称:openemr,代码行数:30,代码来源:Denominator.php

示例2: getMail

 /**
  * Gets the mail from the inbox
  * Reads all the messages there, and adds posts based on them. Then it deletes the entire mailbox.
  */
 function getMail()
 {
     $config = Config::current();
     if (time() - 60 * $config->emailblog_minutes >= $config->emailblog_mail_checked) {
         $hostname = '{' . $config->emailblog_server . '}INBOX';
         # this isn't working well on localhost
         $username = $config->emailblog_address;
         $password = $config->emailblog_pass;
         $subjpass = $config->emailblog_subjpass;
         $inbox = imap_open($hostname, $username, $password) or exit("Cannot connect to Gmail: " . imap_last_error());
         $emails = imap_search($inbox, 'SUBJECT "' . $subjpass . '"');
         if ($emails) {
             rsort($emails);
             foreach ($emails as $email_number) {
                 $message = imap_body($inbox, $email_number);
                 $overview = imap_headerinfo($inbox, $email_number);
                 imap_delete($inbox, $email_number);
                 $title = htmlspecialchars($overview->Subject);
                 $title = preg_replace($subjpass, "", $title);
                 $clean = strtolower($title);
                 $body = htmlspecialchars($message);
                 # The subject of the email is used as the post title
                 # the content of the email is used as the body
                 # not sure about compatibility with images or audio feathers
                 Post::add(array("title" => $title, "body" => $message), $clean, Post::check_url($clean), "text");
             }
         }
         # close the connection
         imap_close($inbox, CL_EXPUNGE);
         $config->set("emailblog_mail_checked", time());
     }
 }
开发者ID:betsyzhang,项目名称:chyrp,代码行数:36,代码来源:emailblog.php

示例3: indexAction

 /**
  * Lists all Idea entities.
  *
  */
 public function indexAction()
 {
     $em = $this->getDoctrine()->getEntityManager();
     $entities = $em->getRepository('TouqIdeasBundle:Idea')->findAll();
     rsort($entities);
     return $this->render('TouqIdeasBundle:Idea:index.html.twig', array('entities' => $entities));
 }
开发者ID:JLou,项目名称:TouqTouq,代码行数:11,代码来源:IdeaController.php

示例4: addCategory

 public function addCategory()
 {
     if (!Phpfox::getService('blog.category')->canAdd()) {
         return $this->alert(Phpfox::getPhrase('blog.you_have_reached_your_limit'));
     }
     $aVals = $this->get('val');
     $oBlogCategoryProcess = Phpfox::getService('blog.category.process');
     $sCleanUrl = Phpfox::getLib('parse.input')->clean($aVals['add']);
     if (Phpfox::getService('blog.category')->isPrivateCategory($sCleanUrl, Phpfox::getUserId())) {
         $this->call('alert("' . Phpfox::getPhrase('blog.already_a_category') . '"); $("#js_add_category").val(""); $("#js_add_category").focus();');
         return false;
     }
     $aCategories = explode(',', $aVals['add']);
     $aRows = array();
     foreach ($aCategories as $sCategory) {
         $sCategory = trim($sCategory);
         $iId = $oBlogCategoryProcess->add($sCategory);
         $aRows[] = array('category_id' => $iId, 'name' => Phpfox::getLib('parse.input')->clean($sCategory, 255));
     }
     rsort($aRows);
     foreach ($aRows as $aRow) {
         Phpfox::getLib('template')->assign(array('aItem' => array('category_id' => $aRow['category_id'], 'name' => $aRow['name'], 'user_id' => Phpfox::getUserId())));
         Phpfox::getLib('template')->getTemplate('blog.block.category-form');
     }
     $this->call('$("#js_add_new_category").prepend("' . $this->getContent() . '").highlightFade(); $("#js_category_info").html("' . Phpfox::getPhrase('blog.added') . '").highlightFade().fadeOut(5000); $("#js_add_category").val(""); $Core.loadInit();');
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:26,代码来源:ajax.class.php

示例5: get_live_list_html

function get_live_list_html($LIVE_LIST, $lang = 'zh-tw')
{
    $l10n = array('en' => array('Live' => 'Live Broadcast', 'Online' => 'On air', 'Over' => 'Over'), 'zh-tw' => array('Live' => '線上直播', 'Online' => '放送中', 'Over' => '已經結束'), 'zh-cn' => array('Live' => '在线观看', 'Online' => '播放中', 'Over' => '放映结束'));
    rsort($LIVE_LIST);
    $html = '';
    $html .= sprintf("<h1 id=\"Live\">%s</h1>\n", htmlspecialchars($l10n[$lang]['Live']));
    $html .= "<div class=\"live\">\n";
    foreach ($LIVE_LIST as $idx => &$live) {
        $html .= "    <div class=\"list\">\n";
        $html .= "<div>\n";
        $formated_from = strftime("%m/%d %R", $live['from']);
        $formated_to = strftime("%R", $live['to']);
        $html .= sprintf("  <span>%s - %s</span>\n", htmlspecialchars($formated_from), htmlspecialchars($formated_to));
        if ($live['isOnline']) {
            $html .= sprintf("  <span class=\"online\">%s</span>\n", htmlspecialchars($l10n[$lang]['Online']));
        } else {
            $html .= sprintf("  <span class=\"online end\">%s</span>\n", htmlspecialchars($l10n[$lang]['Over']));
        }
        $html .= "</div>\n";
        $html .= sprintf("  <div class=\"title\">%s</div>\n", htmlspecialchars($live['title']));
        $html .= sprintf("  <div class=\"speaker\">%s</div>\n", htmlspecialchars($live['speaker']));
        if ($live['isOnline']) {
            $html .= sprintf("  <div class=\"link\"><a href=\"%s\" target=\"_blank\">%s</a></div>\n", htmlspecialchars($live['url']), htmlspecialchars($live['url']));
            $html .= sprintf("  <iframe src=\"%s\" frameborder=\"0\" allowfullscreen></iframe>\n", htmlspecialchars($live['url']));
        }
        $html .= "    </div>\n";
    }
    $html .= "</div>\n";
    // <div class="live">
    return $html;
}
开发者ID:henry860520,项目名称:coscup2015-website,代码行数:31,代码来源:compile-live.php

示例6: inventory_list

function inventory_list($source_dir)
{
    // Open the dir and set the vars
    $root = opendir($source_dir);
    $output = array();
    while ($file = readdir($root)) {
        if ($file != ".." && $file[0] != '.' && $file != "Inventory") {
            //If file is a subdirectory, pop inside
            if (is_dir($file)) {
                // Loop through the subdirectory
                $filestore = array();
                $filestore["dir"] = $file;
                $store = array();
                $store["files"] = inventory_list($source_dir . '/' . $file);
                $filestore = array_merge($filestore, $store);
                $output[] = $filestore;
            } else {
                // Find and spit out only the HTML files
                if (preg_match('/(.*).html/', $file)) {
                    $output[] = array("filename" => $file);
                }
            }
        }
    }
    closedir($root);
    rsort($output);
    return $output;
}
开发者ID:Jonesy,项目名称:Inventory,代码行数:28,代码来源:Inventory.php

示例7: index

 public function index()
 {
     $esta = $this->db->get('establishment', 10);
     foreach ($esta->result() as $v) {
         $data = $this->db->query("select * from offers where establishment_id = '" . $v->id . "' AND offer_type IN ('Discount Percentage', 'Discount', 'Cashback Percentage', 'Cashback', 'Reward Points', 'Reward Point Multiplier');");
         if ($data->num_rows() > 0) {
             $cards_val = array();
             foreach ($data->result() as $data_row) {
                 $cards_arr = explode(",", $data_row->card_name);
                 $cards_count = count($cards_arr);
                 for ($i = 0; $i < $cards_count; $i++) {
                     $disc_per = $this->db->query("select * from offers where establishment_id = '" . addslashes($data_row->establishment_id) . "' AND card_name like '%," . $cards_arr[$i] . ",%' AND offer_type = 'Discount Percentage';")->row();
                     $disc = $this->db->query("select * from offers where establishment_id = '" . addslashes($data_row->establishment_id) . "' AND card_name like '%," . $cards_arr[$i] . ",%' AND offer_type = 'Discount';")->row();
                     $cashback_per = $this->db->query("select * from offers where establishment_id = '" . addslashes($data_row->establishment_id) . "' AND card_name like '%," . $cards_arr[$i] . ",%' AND offer_type = 'Cashback Percentage';")->row();
                     $cashback = $this->db->query("select * from offers where establishment_id = '" . addslashes($data_row->establishment_id) . "' AND card_name like '%," . $cards_arr[$i] . ",%' AND offer_type = 'Cashback';")->row();
                     $reward_pt = $this->db->query("select * from offers where establishment_id = '" . addslashes($data_row->establishment_id) . "' AND card_name like '%," . $cards_arr[$i] . ",%' AND offer_type = 'Reward Points';")->row();
                     $reward_pt_mul = $this->db->query("select * from offers where establishment_id = '" . addslashes($data_row->establishment_id) . "' AND card_name like '%," . $cards_arr[$i] . ",%' AND offer_type = 'Reward Point Multiplier';")->row();
                     $value = @$disc_per->amount + @$disc->amount + @$cashback_per->amount + @$cashback->amount + @$reward_pt->amount + @$reward_pt_mul->amount;
                     $cards_val[$cards_arr[$i]] = $value;
                 }
             }
             rsort($cards_val);
             $maxs = array_search(max($cards_val), $cards_val);
             // $maxs = array_keys($cards_val, max($cards_val));
             echo "Card Identity : " . $maxs;
             echo "<hr />";
             $card_data = array("ultimate_card" => $maxs);
             $this->db->where('id', $est_name);
             $this->db->update('establishment', $card_data);
         }
     }
 }
开发者ID:vzagde,项目名称:maxit,代码行数:32,代码来源:best_card.php

示例8: create

	function create($sitemap_name = '') {
		
		if(!$sitemap_name) $sitemap_name = SS_ADMIN_TO_USERFILE . "/sitemap.xml";
		
		if(empty($sitemap_name)) $sitemap_name = "sitemap_" . $rep_name . ".xml";
		$changefreq 	= array('daily', 'weekly', 'monthly');
		$priority		= array('0.1', '0.5', '1.0');
		$tab_archive	= array();

		rsort($tab_archive);
		$xml = simplexml_load_file(SS_ADMIN_TO_USERFILE . '/google/sitemap_base.xml');
		
		//scan bdd
		$sql = "SELECT * FROM page WHERE etat = 1";
		$res = CBdd::select($sql);
		while($page = mysql_fetch_array($res)) {
			$url = $xml->addChild('url');
			$url->addChild('loc', CUrl::get_urlsite() . "/" . CFunction::formate_chaine(utf8_decode($page['nom']), '-') . "_p" . $page['id']. ".html");
			$url->addChild('lastmod', CDate::formate_date($page['date']));
			$url->addChild('changefreq', $changefreq[rand(0, 2)]);
			$url->addChild('priority', $priority[rand(0, 2)]);
		}

		$html = $xml->asXML();
		file_put_contents($sitemap_name, $html);
	}
开发者ID:rakotobe,项目名称:Rakotobe,代码行数:26,代码来源:CSitemap.php

示例9: wpb_latest_sticky

function wpb_latest_sticky()
{
    /* Get all sticky posts */
    $sticky = get_option('sticky_posts');
    /* Sort the stickies with the newest ones at the top */
    rsort($sticky);
    /* Get the 5 newest stickies (change 5 for a different number) */
    $sticky = array_slice($sticky, 0, 1);
    /* Query sticky posts */
    $the_query = new WP_Query(array('post__in' => $sticky, 'ignore_sticky_posts' => 1));
    // The Loop
    $arr = array();
    if ($the_query->have_posts()) {
        while ($the_query->have_posts()) {
            $the_query->the_post();
            $arr['permlink'] = get_permalink("", "", false);
            $arr['title'] = get_the_title("", "", false);
            $arr['excerpt'] = get_the_excerpt("", "", false);
            $arr['img_url'] = get_the_post_thumbnail_url();
        }
    } else {
        // no posts found
        $arr['excerpt'] = $arr['title'] = $arr['permlink'] = $arr["img_url"] = "404 not found any featured post ! :( ";
    }
    /* Restore original Post Data */
    wp_reset_postdata();
    return $arr;
}
开发者ID:duongcuong96,项目名称:my-wp-themes,代码行数:28,代码来源:functions.php

示例10: setRouters

 /**
  * Sets the list of Router classes this ApiRouter uses
  *
  * @param array $routers A list of Routers indexed by version
  */
 public function setRouters(array $routers)
 {
     $k = array_keys($routers);
     rsort($k);
     $this->latestVersion = current($k);
     $this->routers = $routers;
 }
开发者ID:asgrim,项目名称:joindin-api,代码行数:12,代码来源:ApiRouter.php

示例11: ucc_sort_portalpages_for_client

 function ucc_sort_portalpages_for_client($mypages_id, $sort_type = '', $sort = '')
 {
     //sorting
     if (isset($sort_type) && 'date' == strtolower($sort_type)) {
         //by date
         if (isset($sort) && 'desc' == strtolower($sort)) {
             rsort($mypages_id);
         } else {
             sort($mypages_id);
         }
     } elseif (isset($sort_type) && 'title' == strtolower($sort_type)) {
         //by alphabetical
         if (is_array($mypages_id) && $mypages_id) {
             foreach ($mypages_id as $page_id) {
                 $mypage = get_post($page_id, 'ARRAY_A');
                 $for_sort[$page_id] = strtolower(nl2br($mypage['post_title']));
             }
             if (isset($sort) && 'desc' == strtolower($sort)) {
                 arsort($for_sort);
             } else {
                 asort($for_sort);
             }
             $mypages_id = array_keys($for_sort);
         }
     }
     return $mypages_id;
 }
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:27,代码来源:class.user_common.php

示例12: System_Creator

 function System_Creator($num, $test = NULL)
 {
     //Creation and rating of chromosomes of future systems
     $ratings = array();
     $chromosomes = array();
     for ($i = 0; $i < $num; $i++) {
         $chromosome = $this->Random_Chromosome();
         $rating = $this->Rate_Chromosome($chromosome);
         $ratings[] = $rating;
         $chromosomes[] = $chromosome;
     }
     rsort($ratings);
     foreach ($ratings as $key => $value) {
         $this->queue[$key] = array('rating' => $value, 'chromosome' => $chromosomes[$key]);
     }
     //Spreading energy between most perspective systems in first launch
     $count = $this->simultaneous_systems_count;
     $energy_per_system = $this->energy / $count;
     //Creating systems
     $threads = new Threads();
     for ($i = 0; $i < $count; $i++) {
         $threads->newThread('D:/web/www/lh/tests/fuzzy/system/system.php', $this->queue[0]);
         //Delete first element and reindex queue
         unset($this->queue[0]);
         $this->queue = array_values($this->queue);
     }
     while (false !== ($result = $threads->iteration())) {
         echo $result . "\r\n";
     }
     //$this->Run_Test($test);
 }
开发者ID:0-php,项目名称:AI,代码行数:31,代码来源:system_creator.class.php

示例13: recentSpectrograms

function recentSpectrograms($subnet, $WEBPLOTS, $MINFILES, $MAXDAYS)
{
    # Loop from today and over the $MAXDAYS last days, until at least $MINFILES spectrograms found
    $filesarray = array();
    $time = time() + 1000;
    # check 1000s ahead in case time is slow on kiska
    $daysago = 0;
    do {
        list($year, $month, $day, $hour, $minute) = epoch2YmdHM($time);
        $minute = floorminute($minute);
        $filepath = "{$WEBPLOTS}/{$subnet}/{$year}/{$month}/{$day}/2*.png";
        $thisarray = glob($filepath);
        rsort($thisarray);
        if (count($thisarray) > 0) {
            $filesarray = array_merge($filesarray, $thisarray);
        }
        $time = $time - 86400;
        $daysago++;
    } while (count($filesarray) < $MINFILES && $daysago < $MAXDAYS);
    rsort($filesarray);
    $nonzerofilesarray = array();
    foreach ($filesarray as $myfile) {
        $size = filesize($myfile);
        if ($size > 0) {
            $nonzerofilesarray[] = $myfile;
            #print "$myfile<br/>\n";
        }
    }
    $nonzerofilesarray = array_slice($nonzerofilesarray, 0, $MINFILES);
    return $nonzerofilesarray;
}
开发者ID:geoscience-community-codes,项目名称:IceWeb,代码行数:31,代码来源:recentSpectrograms.php

示例14: denormalize

 static function denormalize($phone)
 {
     $p = self::normalize($phone);
     if (!self::$phones) {
         self::$phones = (include __DIR__ . '/config/phones.php');
     }
     $config = self::$phones;
     if (!count($config)) {
         return $p;
     }
     $codes = array_keys($config);
     rsort($codes);
     foreach ($codes as $code) {
         if ($code == mb_substr($p, 0, mb_strlen($code))) {
             $mask = $config[$code]['mask'];
             $phone_array = str_split(mb_substr($p, mb_strlen($code)));
             $mask_array = str_split($mask);
             foreach ($mask_array as $key => $symbol) {
                 if ('#' == $symbol) {
                     $mask_array[$key] = array_shift($phone_array);
                 }
             }
             return implode('', $mask_array);
         }
     }
     return null;
 }
开发者ID:Sharoff45,项目名称:zadarma-api,代码行数:27,代码来源:HelperPhone.php

示例15: __construct

 public function __construct()
 {
     /**
      * 实例化容器,并且保存在此载体中
      */
     if (empty(static::$app)) {
         static::$app = new Application();
     }
     /**
      * 通过反射获取所有父类,并且获取他们的类名,通过这些类名来形成构造函数
      * 比如当前类的构造函数为 $this->OBlood()
      * 切记:Application类不能继承此类
      */
     $reflectionClass = new \ReflectionClass($this);
     $constructs[] = $reflectionClass->getShortName();
     $parentClass = $reflectionClass->getParentClass();
     while ($parentClass != false) {
         $constructs[] = $parentClass->getShortName();
         $parentClass = $parentClass->getParentClass();
     }
     /**
      * 这里采用倒叙的方式来进行排列,
      * 主要是以顶级父类为最先执行,一次向下
      */
     rsort($constructs);
     foreach ($constructs as $construct) {
         if (method_exists($this, $construct)) {
             call_user_func_array([$this, $construct], func_get_args());
         }
     }
 }
开发者ID:Oblood,项目名称:framework,代码行数:31,代码来源:OBlood.php


注:本文中的rsort函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。