Beispiel #1
0
    </div>
    <div class="section">
        <h2>List of Words</h2>
        <!-- Ex. 4: List of Words & Ex 6: Query Parameters -->
        <?php 
function getWordsByOrder($listOfWords, $orderby)
{
    $resultArray = $listOfWords;
    sort($resultArray);
    if ($orderby === 1) {
        rsort($resultArray);
    }
    return $resultArray;
}
$orderby = 0;
$orderedArray = getWordsByOrder($lines, $orderby);
?>
        <p>
            All of words ordered by <strong>alphabetical order</strong> are followings :
        </p>
        <ol>
            <?php 
foreach ($orderedArray as $element) {
    $temp = explode('-', $element);
    if (strlen($temp[0]) > 6) {
        ?>
            <li class="long"><?php 
        echo $element;
        ?>
</li>
Beispiel #2
0
} else {
    if ($orderby == 1) {
        $a = "alphabet reverse order";
    }
}
?>
        <p>
            All of words ordered by <strong><?php 
echo $a;
?>
</strong> are followings :
        </p>

        <ol>
            <?php 
$orderedWords = getWordsByOrder($lines, $orderby);
foreach ($orderedWords as $value) {
    $word = explode("\t", $value);
    if (strlen($word[0]) > 6) {
        ?>
            <li class="long"> <?php 
        echo $word[0] . " - " . $word[1];
        ?>
</li>
            <?php 
    } else {
        ?>
            <li> <?php 
        echo $word[0] . " - " . $word[1];
        ?>
</li>
Beispiel #3
0
{
    $resultArray = $listOfWords;
    if ($orderby == 0) {
        sort($resultArray);
    } elseif ($orderby == 1) {
        rsort($resultArray);
    }
    return $resultArray;
}
?>
        <p>
            All of words ordered by <strong>alphabetical order</strong> are followings :
        </p>
        <ol>
        <?php 
$result = getWordsByOrder($file_explode, 1);
foreach ($result as $val) {
    $string = explode("\t", $val);
    $string2 = explode("\t", $val);
    if (strlen($string[0]) > 6) {
        ?>
                    <li class="long"><?php 
        echo $string2[0];
        ?>
 - <?php 
        echo $string2[1];
        ?>
</li> 
        
        <?php 
    } else {
Beispiel #4
0
if (!isset($orderby) or $orderby == "") {
    $orderby = 0;
}
if ($orderby == 1) {
    $orderby_string = "back " . $orderby_string;
}
?>
        <p>
            All of words ordered by <strong><?php 
echo $orderby_string;
?>
</strong> are followings :
        </p>
        <ol>
		<?php 
$resultArray = getWordsByOrder($file, $orderby);
foreach ($resultArray as $line) {
    $tokens = explode("\t", $line);
    if (strlen($tokens[0]) > 6) {
        ?>
					<li class="long"><?php 
        echo $line;
        ?>
</li>
				<?php 
    } else {
        ?>
					<li><?php 
        echo $line;
        ?>
</li>
Beispiel #5
0
        <?php 
function getWordsByOrder($listOfWords, $orderby)
{
    $resultArray = $listOfWords;
    //                implement here.
    ksort($resultArray);
    if ($orderby) {
        krsort($resultArray);
    }
    return $resultArray;
}
$orderby = $_GET["orderby"];
if (!isset($orderby) || strlen($orderby) == 0) {
    $orderby = 0;
}
$orderedWords = getWordsByOrder($dictionary, $orderby);
?>
        <p>
            All of words ordered by <strong><?php 
echo $orderby ? "alphabet reverse order" : "alphabet order";
?>
</strong> are followings :
        </p>
        <ol>
			<?php 
$longer = 6;
foreach ($orderedWords as $key => $value) {
    $cnt = strlen($key);
    ?>
						<li<?php 
    echo $cnt > $longer ? " class=\"long\"" : "";
Beispiel #6
0
$orderby = 0;
if (isset($_GET["orderby"])) {
    $orderby = $_GET["orderby"];
}
?>
            All of words ordered by <strong>alphabet <?php 
if ($orderby == 1) {
    ?>
reverse<?php 
}
?>
 order</strong> are followings :
        </p>
        <ol>
            <?php 
$get_words_by_order = getWordsByOrder($lines, $orderby);
foreach ($get_words_by_order as $line) {
    $token = explode("\t", $line);
    $line = implode(" - ", $token);
    $wordsLength = strlen($token[0]);
    ?>
            <li <?php 
    if ($wordsLength > 6) {
        ?>
class="long"<?php 
    }
    ?>
><?php 
    echo $line;
    ?>
</li>
Beispiel #7
0
             
         }
         else
         {
             arsort($resultArray);
         }
         return $resultArray;
     }
 ?>
 <p>
     All of words ordered by <strong>alphabetical order</strong> are followings :
 </p>
 <ol>
     <?php
         $order = 0;
         $lst = getWordsByOrder($line, 1);
         foreach($lst as $words)
         {
             ?><li<?
             $var = strtok($words, "\t");
             if (strlen($var)>6)
             {
                   ?> class="long"><?
             }
             else
             {
                 ?>><?
             }
             $var .= ' - ';
             $var .= strtok("\t");
             ?><?=$teg.$var?></li><?
Beispiel #8
0
    <div class="section">
        <h2>List of Words</h2>
<!-- Ex. 4: List of Words & Ex 6: Query Parameters -->
        <?php 
$orderby = 0;
function getWordsByOrder($listOfWords, $orderby)
{
    $resultArray = $listOfWords;
    if ($orderby == 0) {
        sort($resultArray, SORT_STRING);
    } elseif ($orderby == 1) {
        rsort($listOfWords);
    }
    return $resultArray;
}
$orderlist = getWordsByOrder($lines, $orderby);
?>
        <p>
            All of words ordered by <strong>alphabetical order</strong> are followings :
        </p>
        <ol>
        	<?php 
for ($i = 0; $i < sizeof($orderlist); $i++) {
    $words = explode("-", $orderlist[$i]);
    if (strlen($words[0]) >= 7) {
        echo "<li class=" . "\"long\"" . ">" . $orderlist[$i] . "</li>";
    } else {
        echo "<li>" . $orderlist[$i] . "</li>";
    }
}
?>
Beispiel #9
0
}
if ($orderby == 0) {
    $order = "";
} else {
    $order = "reverse";
}
?>
            <p>
                All of words ordered by <strong>alphabetical <?php 
echo $order;
?>
 order</strong> are followings :
            </p>
            <ol>
        <?php 
$resultArray = getWordsByOrder($lines, $orderby);
foreach ($lines as $word) {
    $wordArray = explode("\t", $word);
    if (strlen($wordArray[0]) > 6) {
        $class = " class=\"long\"";
    } else {
        $class = "";
    }
    ?>
                    <li<?php 
    echo $class;
    ?>
> <?php 
    echo $wordArray[0];
    ?>
 -  <?php 
Beispiel #10
0
    if ($orderby == 0) {
        sort($resultArray);
    } else {
        if ($orderby == 1) {
            rsort($resultArray);
        }
    }
    return $resultArray;
}
if ($_GET["orderby"] == "") {
    $orderedList = getWordsByOrder($lines, 0);
} else {
    if (isset($_GET["orderby"])) {
        $orderedList = getWordsByOrder($lines, $_GET["orderby"]);
    } else {
        $orderedList = getWordsByOrder($lines, 0);
    }
}
if ($orderby == 0) {
    print "All of words ordered by <strong>alphabetical order</strong> are followings :";
} else {
    if ($orderby == 1) {
        print "All of words ordered by <strong>alphabetical reverse order</strong> are followings :";
    }
}
print "<ol>";
foreach ($orderedList as $word) {
    $tmp = explode("\t", $word);
    if (strlen($tmp[0]) > 6) {
        print "<li class='long'>" . $tmp[0] . " - " . $tmp[1] . "</li>";
    } else {