English 中文(简体)
审结相同案件
原标题:Switches with identical cases
  • 时间:2012-04-16 01:17:27
  •  标签:
  • php

我试图创建一页,基本上把录像流推上,并通过观众加以组织,这样一页最有看法。

我对购买力平价说得很新,因此,我这样做的方式极其低效,时间长,但我知道的主要事情是使用nes的开关。

This works perfectly when every video has a different number of viewers above 0. My problem comes when 2 videos have the same amount of viewers. When this happens all streams retain their original order.

这里是造成这一问题的一部法典的缩略本。

$viewarray = array($viewers1, $viewers2, $viewers3, $viewers4);

rsort($viewarray, SORT_NUMERIC);

for ($z=0; $z<=3; $z++)
{
if ($viewarray[$z] == 0) {break;}
switch($viewarray[$z]) 
{   
    case $viewers1:
        switch($z)
        {
            case 0:
                //code which implements the re-ordering
            case 1:
            case 2:
            case 3:
        }
        break;
    case $viewers2:
        switch($z)
        {
            case 0:
            case 1:
            case 2:
            case 3:
        }
        break;
    case $viewers3:
        switch($z)
        {
            case 0:
            case 1:
            case 2:
            case 3:
        }
        break;
    case $viewers4: 
        switch($z)
        {
            case 0:
            case 1:
            case 2:
            case 3:
        }
        break;      
}
}

<代码>viewarray作了分类,以便按正确顺序列出观众人数。 转换后,对照每个溪流的实际观察者人数,对每个数字进行核对,以找到其对应的。

我认为,如果开关的论据与2起案件相对应,那就只是首选,但令人悲伤。 我试图用同样的话来取代这一说法。

希望得到任何帮助。

问题回答

谁是谁。 全部报废。 你们应该做的是,每个溪流都应有一个数据库记录。 每当有人看上下流时,数据库记录中的一栏就应当作为反面加。 然后,在您的数据库表中加上该栏的索引,当你从您的数据库中把流拉到清单时,你简单地按在座标中的观点栏数分类。 www.un.org/spanish/ecosoc

<><>>> EDIT:如果你能够把录像带上正确的次序!

为什么没有这样的相关阵列:array ($video2 =>$viewers1,$video2 =>$viewers2),那么你可以按照数值进行分类。 然后,你可以使用arsort(,并读到各阵列的录像钥匙,处理重新排序的问题。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签