remove-duplicate - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of remove-duplicate.php
- <?php echo "
- <html>
- <head>
- <style>
- table{
- width:400px;
- float:left;
- }
- table tr th{
- background:red;
- }
- .bold{
- font-weight:bold;
- }
- </style>
- </head>
- <body>
- <table>
- <tr>
- <th>Fee</th>
- <th>Amount</th>
- </tr>";
- $fee_cat = "";
- $cat = array('Annual Fee-Disability Scholarship','Annual Fee-First rank Scholarship','Monthly Fee-First rank Scholarship');
- $amount = array('1000-20','1000-10','560-5');
- foreach (array_combine($cat, $amount) as $cat => $amount){
- $cat_ry = explode('-', $cat);
- $amount_ry = explode('-', $amount);
- $fee = $amount_ry[0];
- $sch_cat = $cat_ry[1];
- $sch = $amount_ry[1];
- if($cat_ry[0] != $fee_cat){
- $fee_cat = $cat_ry[0];
- echo "
- <tr>
- <td class='bold'>$fee_cat</td>
- <td>$fee</td>
- </tr>
- <tr>
- <td>$sch_cat</td>
- <td>$sch</td>
- </tr>";
- }
- } echo "
- <tr>
- </table>
- </body>
- </html>
- ";
- ?>