3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tagdes[0]='靚 大 包 炸 油 蔥 酥 FRY SHALLOTS 1KG'; $tagpri[0]='$5.80'; $tagcod[0]='DVFS1'; $tagloc[0]='6A3 F10'; $tagwei[0]='1KG'; $tagupc[0]='10'; $taguni[0]='PKT'; $tagqty[0]='10'; $tagline[1]='NSCA1'; $tagdes[1]='大 粒 腰 果 CASHEW NUT W320'; $tagpri[1]='$12.50'; $tagcod[1]='NSCA1'; $tagwei[1]='1KG'; $tagupc[1]='11.25'; $taguni[1]='KG'; $tagqty[1]='6'; $tagline[2]='RVBV5'; $tagdes[2]='靚 粉 絲(大 包)BEAN VERM (L)'; $tagpri[2]='$1.45'; $tagcod[2]='RVBV5'; $tagloc[2]='F11'; $tagwei[2]='500GR'; $tagupc[2]='30'; $taguni[2]='PKT'; $tagqty[2]='6'; $tagline[3]='DVCO'; $tagdes[3]='靚 白 菜 干 DEHYDRATED COLE A"'; $tagpri[3]='$1.45'; $tagcod[3]='DVCO'; $tagloc[3]='10B0'; $tagwei[3]='150GR'; $tagupc[3]='999'; $taguni[3]='PKT'; $tagqty[3]='11'; $tagline[4]='SNPC@SD'; $tagdes[4]='靚 日 龍 蝦 片 S&D PRAWN CRACKER 2KG'; $tagpri[4]='$5.80'; $tagcod[4]='SNPC@SD'; $tagwei[4]='2KG'; $tagupc[4]='6'; $taguni[4]='BOX'; $tagqty[4]='7'; $tagline[5]='NSPI'; $tagdes[5]='大 粒 崧 子 肉 PINE NUT 1 KG'; $tagpri[5]='$38.00'; $tagcod[5]='NSPI'; $tagloc[5]='FREEZER'; $tagwei[5]='1KG'; $tagupc[5]='20'; $taguni[5]='KG'; $tagqty[5]='20'; $tagline[6]='CVMBL'; $tagdes[6]='靚 白 靈 菇 BAC-LING MUSHROOM A"'; $tagpri[6]='$3.50'; $tagcod[6]='CVMBL'; $tagloc[6]='F7'; $tagwei[6]='850GR'; $tagupc[6]='12'; $taguni[6]='TIN'; $tagqty[6]='24'; $tagline[7]='CVMSSC'; $tagdes[7]='靚 開 邊 草 菇 STRAW M\'ROOM(CUT)'; $tagpri[7]='$1.35'; $tagcod[7]='CVMSSC'; $tagloc[7]='F7'; $tagwei[7]='425GR'; $tagupc[7]='24'; $taguni[7]='CAN'; $tagqty[7]='48'; $lastline=max(array_keys($tagcod)); $marker=1; // initiate group for($n=0;$n<=$lastline;++$n) { if(substr( $tagcod[$n], 0, 1 ) === "-"){$marker++;} // is it a new group? $taggroup[$n]=$marker; if(!isset($tagcod[$n])){$tagcod[$n]='';} if(!isset($tagdes[$n])){$tagdes[$n]='';} if(!isset($tagpri[$n])){$tagpri[$n]='';} if(!isset($tagloc[$n])){$tagloc[$n]='';} if(!isset($tagloc[$n])){$tagloc[$n]='';} if(!isset($tagwei[$n])){$tagwei[$n]='';} if(!isset($tagupc[$n])){$tagupc[$n]='';} if(!isset($taguni[$n])){$taguni[$n]='';} if(!isset($tagqty[$n])){$tagqty[$n]='';} $tagctn[$n]=''; // initiate ctn variable (default to nothing); $tagloo[$n]=$tagqty[$n]; // initiate loose variable (default to nothing); if($tagupc[$n]>0&&$tagupc[$n]<9999) { $tagctn[$n]=floor($tagqty[$n]/$tagupc[$n]); // ctn variable only if qty is > upc $tagloo[$n]=$tagqty[$n]-$tagctn[$n]*$tagupc[$n]; // loose variable is qty - ctns/upc } $tagbulk[$n]=0; // bulk marker assume no if($tagctn[$n]>0){$tagbulk[$n]=1;} // change to yes if ctn qty is bigger than 0; $tagline[$n]=$n+1; // line number starting from 1 } // array_multisort($taggroup,$tagbulk,$tagloc,$tagcod,$tagline,$tagqty,$taguni,$tagdes,$tagupc,$tagpri); $html = <<<EOF <html> <head> <meta charset="UTF-8"> <style> * { font: 16px "courier new"; } thead { display: table-header-group; } tbody { display: table-row-group; } tfoot { display: table-footer-group; position: fixed; bottom: 0; /* Because it's footer */ } table{ border-collapse:collapse; table-layout: fixed; overflow: hidden; } td{ padding:0; margin:0; } div.limit { width:100%; vertical-align:top; white-space: nowrap; text-overflow: clip; overflow: hidden; } td.f { background-color: #B0B0B0; } td.c { background-color: #B0B0B0; } .qty { border: 1px solid black; text-align: right; width: 40; } .fre { border: 1px solid black; text-align: right; width: 20; } .uni { border: 1px solid black; text-align: right; width: 40; } .des { border: 1px solid black; text-align: left; width: 410; } .ctn { border: 1px solid black; text-align: right; width: 20; } .upc { border: 1px solid black; text-align: right; width: 20; } .pri { border: 1px solid black; text-align: right; width: 50; } .loc { border: 1px solid black; border-collapse: collapse; text-align: left; width: 140; } .left { text-align: left; height: 50; width: 200; } .middle { text-align: left; height: 50; width: 300; } .right { text-align: right; height: 50; width: 200; } .span { text-align: right; height: 50; } .56 { font: bold 56px "courier new"; } .38 { font: bold 38px "courier new"; } .24 { font-size:24px; } .18 { font-size:18px; } .12 { font-size:12px; } </style> </head> <body> <table width="750px"> <thead> <tr><td> <table width="100%" id="page-header"> <tr> <td class="left 56 limit">$ddat</td> <td class="middle 12 limit">$tagnote</td> <td class="right 56 limit">$code</td> </tr> <tr> <td class="left 12 limit">$invno<br />$odat</td> <td class="span 38 limit" colspan="2">CARTON[ ]&nbsp;&nbsp;&nbsp;&nbsp;LOOSE[ ]</td> </tr> </table> <table width="100%" id="table-header"> <tr> <td class="loc">location</td><td class="qty">qty</td><td class="fre">f</td><td class="uni">unit</td><td class="des">description</td><td class="ctn">ctn</td><td class="upc">upc</td><td class="pri">price</td> </tr> </table> </td></tr> <tr> </tr> </thead> <tbody> <tr><td> <table width="100%" id="table-header"> EOF; $lastline=max(array_keys($tagcod)); for($n=0;$n<=$lastline;++$n) { $atagcod[$n]=$tagcod[$n]; $atagdes[$n]=$tagdes[$n]; $atagline[$n]=$tagline[$n]; $atagpri[$n]=$tagpri[$n]; $atagloc[$n]=$tagloc[$n]; $atagwei[$n]=$tagwei[$n]; $atagupc[$n]=$tagupc[$n]; $ataguni[$n]=$taguni[$n]; $atagqty[$n]=$tagqty[$n]; $atagloo[$n]=$tagloo[$n]; $atagctn[$n]=$tagctn[$n]; $acssfre='nf'; if($atagloc[$n]=="FREEZER"||$atagloc[$n]=="FRIDGE"){$atagupc[$n]='';$acssfre='f';} if($atagloc[$n]=="LOOSE"||$atagloc[$n]=="BULK"){$atagloc[$n]='';} if($atagctn[$n]==0){$atagctn[$n]='&nbsp;';$atagupc[$n]='&nbsp;';$acssctn='nc';}else{$acssctn='c';} if($atagloo[$n]==0){$atagloo[$n]='&nbsp;';} $atagctn[$n]=$atagctn[$n]; $html .= <<<EOF <tr> <td class="loc $acssfre"><div class="limit">$atagloc[$n]</div></td> <td class="qty $acssfre"><div class="limit">$atagqty[$n]</div></td> <td class="fre $acssfre $acssctn"><div class="limit">&nbsp;</div></td> <td class="uni $acssfre"><div class="limit">$ataguni[$n]</div></td> <td class="des $acssfre"><div class="limit">$atagdes[$n]</div></td> <td class="ctn $acssfre"><div class="limit">$atagctn[$n]</div></td> <td class="upc $acssfre"><div class="limit">$atagupc[$n]</div></td> <td class="pri $acssfre"><div class="limit">$atagpri[$n]</div></td> </tr> EOF; } $html .= <<<EOF </table> </td></tr> </tbody> <tfoot> <tr><td> <table width="100%" id="table-footer"> <tr><td> </td></tr> </table> </td></tr> </tfoot> <table width="750px"> <thead> <tr><td> <table width="100%" id="page-header"> <tr> <td class="left 56 limit">$ddat</td> <td class="middle 12 limit">$tagnote</td> <td class="right 56 limit">$code</td> </tr> <tr> <td class="left 12 limit">$invno<br />$odat</td> <td class="span 38 limit" colspan="2">CARTON[ ]&nbsp;&nbsp;&nbsp;&nbsp;LOOSE[ ]</td> </tr> </table> <table width="100%" id="table-header"> <tr> <td class="loc">location</td><td class="qty">qty</td><td class="fre">f</td><td class="uni">unit</td><td class="des">description</td><td class="ctn">ctn</td><td class="upc">upc</td><td class="pri">price</td> </tr> </table> </td></tr> <tr> </tr> </thead> <tbody> <tr><td> <table width="100%" id="table-header"> EOF; // close and output PDF document $lastline=max(array_keys($tagcod)); for($n=0;$n<=$lastline;++$n) { $btagcod[$n]=$tagcod[$n]; $btagdes[$n]=$tagdes[$n]; $btagline[$n]=$tagline[$n]; $btagpri[$n]=$tagpri[$n]; $btagloc[$n]=$tagloc[$n]; $btagwei[$n]=$tagwei[$n]; $btagupc[$n]=$tagupc[$n]; $btaguni[$n]=$taguni[$n]; $btagqty[$n]=$tagqty[$n]; $btagloo[$n]=$tagloo[$n]; $btagctn[$n]=$tagctn[$n]; $btaggroup[$n]=$taggroup[$n]; $btagbulk[$n]=$tagbulk[$n]; $btagline[$n]=$tagline[$n]; $bcssfre='nf'; if($btagloc[$n]=="FREEZER"||$btagloc[$n]=="FRIDGE"){$btagupc[$n]='';$bcssfre='f';} if($btagloc[$n]=="LOOSE"||$btagloc[$n]=="BULK"){$btagloc[$n]='';} if($btagctn[$n]==0){$btagctn[$n]='&nbsp;';$btagupc[$n]='&nbsp;';$bcssctn='nc';}else{$bcssctn='c';} if($btagloo[$n]==0){$btagloo[$n]='&nbsp;';} $html .= <<<EOF <tr> <td class="loc $bcssfre"><div class="limit">$btagloc[$n]</div></td> <td class="qty $bcssfre"><div class="limit">$btagqty[$n]</div></td> <td class="fre $bcssfre $bcssctn"><div class="limit">&nbsp;</div></td> <td class="uni $bcssfre"><div class="limit">$btaguni[$n]</div></td> <td class="des $bcssfre"><div class="limit">$btaggroup[$n]#$btagbulk[$n]#$btagline[$n]#$btagdes[$n]</div></td> <td class="ctn $bcssfre"><div class="limit">$btagctn[$n]</div></td> <td class="upc $bcssfre"><div class="limit">$btagupc[$n]</div></td> <td class="pri $bcssfre"><div class="limit">$btagpri[$n]</div></td> </tr> EOF; } $html .= <<<EOF </table> </td></tr> </tbody> <tfoot> <tr><td> <table width="100%" id="table-footer"> <tr><td> </td></tr> </table> </td></tr> </tfoot> EOF; // close and output PDF document file_put_contents('aftermultisort.html', $html); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $ddat in /in/Xg1Bt on line 238 Warning: Undefined variable $tagnote in /in/Xg1Bt on line 239 Warning: Undefined variable $code in /in/Xg1Bt on line 240 Warning: Undefined variable $invno in /in/Xg1Bt on line 243 Warning: Undefined variable $odat in /in/Xg1Bt on line 243 Warning: Undefined variable $ddat in /in/Xg1Bt on line 321 Warning: Undefined variable $tagnote in /in/Xg1Bt on line 322 Warning: Undefined variable $code in /in/Xg1Bt on line 323 Warning: Undefined variable $invno in /in/Xg1Bt on line 326 Warning: Undefined variable $odat in /in/Xg1Bt on line 326 Warning: file_put_contents(): open_basedir restriction in effect. File(aftermultisort.html) is not within the allowed path(s): (/tmp:/in:/etc) in /in/Xg1Bt on line 402 Warning: file_put_contents(aftermultisort.html): Failed to open stream: Operation not permitted in /in/Xg1Bt on line 402

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
36.68 ms | 403 KiB | 8 Q