我有一个像下面给出的大字符串我只检索字符串中的日期,该字符串来自|的爆炸字符串并且〜在第6个index.and在组合框中显示日期。现在我将整个字符串与组合框中的选择日期进行比较并打印匹配日期。这一切都运行正常,但现在我想如果用户没有选择任何日期意味着第一次时间页打开打印第一个日期匹配整个string.means当用户第一次去这个页面时他不会选择任何东西然后打印第一个匹配所有字符串的日期。
2~FAFO/683/2014~27~HIMANSHU AND ANOTHER~SUDHANSHU AND 2 ORS.~D~2014-03-19~06:11:16
18/03/2014|9~COPP/43/2012~21~DASAPRAKASH HOTELS AND RESORTS PVT. LTD.~M/S KUMAR ASHIYANA
PVT.LTD.~D~2014-03-24~06:11:16 18/03/2014|10~WRIA/50923/2012~27~LALLAN KUMAR~COAL INDIA
LTD. THRU. ITS CHAIRMAN AND OTHERS~D~2014-03-24~06:11:16
18/03/2014|10~WRIA/52176/2011~49~MANEESH THAKUR~STATE OF U.P. AND OTHERS~D~2014-03-
24~06:11:16 18/03/2014|39~WRIC/48169/2002~6~TAUFIQ KAMAL~STATE OF U.P. THRU SECY.
HOUSING GOVT. OF U.P. AND OTHERS~D~2014-03-24~06:11:16
18/03/2014|39~WRIC/14267/2007~69~MUNNI
LAL BHARGAVA~STATE OF U.P. AND OTHERS~D~2014-03-24~06:11:16 19/03/2014
$selecteddate = $_GET[ "selecteddate" ];
$causelistarray = explode('|',$return);
$causelistlen= count($causelistarray);
for( $a=0;$a<$causelistlen; $a++)
{
$final = explode ('~',$causelistarray[$a]);
$da=$final[6];
if( $final[6] == $selecteddate)
{
print"<ul data-role=listview data-icon=false style=margin-top:15px;>";
print" <li >";
print"<font class=alignleft size='3' style=color:#FFFF00;>";
if($final[0] == '0')
{
echo $final[0]= 'CJ';
}
else
{
echo $final[0];
}
print"</font>";
print"<font size='3' class=aligncenter style=color:#FF8000;>";
echo $final[2];
print"</font>";
print"<font class=alignright size='3' style=color:#00CC00;>";
echo $final[1];
print"</font>";
print"<br/>";
print"<br/>";
print"<font style=margin-left:7%;color:#01DFD7;>";
echo "Party 1:-". $final[3];
print"</font>";
print"<br/>";
print"<font style=margin-left:7%;color:#FFFFFF;>";
echo "Party 2:-". $final[4];
print"</font>";
print"</a>";
print" </li >";
print" </ul>";
}
//elseif($final[6] == $item[6])
elseif($selecteddate == 0)
{
print"<ul data-role=listview data-icon=false style=margin-top:2%;>";
print" <li >";
print"<font class=alignleft size='3' style=color:#FFFF00;>";
if($final[0] == '0')
{
echo $final[0]= 'CJ';
}
else
{
echo $final[0];
}
print"</font>";
print"<font size='3' class=aligncenter style=color:#FF8000;>";
echo $final[2];
print"</font>";
print"<font class=alignright size='3' style=color:#00CC00;>";
echo $final[1];
print"</font>";
print"<br/>";
print"<br/>";
print"<font style=margin-left:7%;color:#01DFD7;>";
echo "Party 1:-". $final[3];
print"</font>";
print"<br/>";
print"<font style=margin-left:7%;color:#FFFFFF;>";
echo "Party 2:-". $final[4];
print"</font>";
print"</a>";
print" </li >";
print" </ul>";
}
}
请尽快帮助我.thankyou
答案 0 :(得分:0)
我无法清楚地理解问题,但我正在从我理解的任何方面回答这个问题。如果这不是你想要的评论。
$causelistarray = explode('|',$return);
$causelistlen= count($causelistarray);
if(isset($_GET[ "selecteddate" ])){
$selecteddate = $_GET[ "selecteddate" ];
}else{
$selecteddate = explode ('~',$causelistarray[0])[6];//get very first date of data
for( $a=1;$a<$causelistlen; $a++){
$tmp=explode ('~',$causelistarray[$a])[6];
if($tmp<$selecteddate)
$selecteddate=$tmp;
}
}
for( $a=0;$a<$causelistlen; $a++)
........to be continued.........