Array:
<?php
$a = ['IUBAT'];
//echo $a[0];
?>
<?php
$a = ['IUBAT'];
//echo $a[0];
?>
CSS Files:
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.20/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.20/css/dataTables.bootstrap4.min.css">
JavaScript Files:
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.js
"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.20/js/dataTables.bootstrap4.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#example').DataTable();
} );
</script>
Full Code:
<?php
$a = ['IUBAT'];
//echo $a[0];
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.20/css/dataTables.bootstrap4.min.css">
</head>
<body>
<table id="example" class="table table-hover table-bordered" style="width:100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Age</th>
<th>University 1</th>
<th>University 2</th>
<th>University 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>Amit</td>
<td>Programmer</td>
<td>25</td>
<?php
if (count($a) == 3) {
foreach ($a as $value) {
echo "<td>";
echo $value;
echo "</td>";
}
}elseif(count($a) == 2){
foreach ($a as $value) {
echo "<td>";
echo $value;
echo "</td>";
}
echo "<td>"."</td>";
}elseif(count($a) == 1){
foreach ($a as $value) {
echo "<td>";
echo $value;
echo "</td>";
}
echo "<td>"."</td>";
echo "<td>"."</td>";
}
?>
</tr>
</tbody>
</table>
</body>
</html>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.js
"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.20/js/dataTables.bootstrap4.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#example').DataTable();
} );
</script>
EmoticonEmoticon