Example #1
0
<h2 class="title">Request Details</h2>
<table id="box-table-a">
<thead>
<tr>
<th scope="col">Fields</th>
<th scope="col">Details</th>
</tr>
</thead>


<?php 
$i = 0;
while ($i < $num_row) {
    if ($i != 1) {
        if ($i == 17) {
            $col[$i] = explosion($col[$i]);
        }
        ?>
		<tr>
		<td>
<?php 
        echo $col1[$i];
        ?>
		</td>
		<td>
<?php 
        echo $col[$i];
        ?>
		</td>
		</tr>
<?php 
Example #2
0
File: explode.php Project: motlj/HW
<?php

//INCOMPLETE AND INCORRECT CODE:
//$myString = "I really hope that I'm doing this correctly.";
//$word = "";
//$explosion = array();
//	for ($i = 0; $i == count($myString); $i++){
//		if($myString{$i} == " "){
//			array_push($explosion, $i);
//}
//}
//print_r($explosion);
function explosion($delimiter, $myString)
{
    $word = "";
    $myExplosion = array();
    for ($i = 0; $i < strlen($myString); $i++) {
        if ($myString[$i] == " ") {
            array_push($myExplosion, $word);
            $word = "";
        } else {
            $word = $word . $myString[$i];
        }
    }
    array_push($myExplosion, $word);
    return $myExplosion;
}
print_r(explosion(" ", "I really hope this works."));