www.softswot.com
Solutions through software innovation.
©2003

Source Viewer


Input the URL of the file to view. The viewed file must be on the www.downintheflood.com server, the server must support php and the viewed file must be in an allowed directory. Displayed code will include all html and php code. Using standard browser View Source php code is not displayed.

The code for http://www.downintheflood.com/source/examples.php5 is displayed.

<pre>
<?php
$hr 
'<br /><hr style="border:solid #0000CC 1px; height:1px; width:555px; position:absolute; left:5px;"/><br />';
$fc '<font style="color:#0000CD;font-weight:bold;">';
$fruits = array( "d" => "lemon""a" => "orange""b" => "banana""c" => "apple" );
echo 
"$hr\n";
print_r($fruits);
echo 
$hr;
print 
"\n$fc arsort</font> Sort an array in reverse order and maintain index association\n\n";
arsort($fruits);
foreach (
$fruits as $key => $val) { echo "$key = $val\n"; }
echo 
$hr;
print 
"\n$fc asort</font> Sort an array and maintain index association\n\n";
asort($fruits);
foreach (
$fruits as $key => $val) { echo "$key = $val\n"; }
echo 
$hr;
print 
"\n$fc krsort</font> Sort an array by key in reverse order\n\n";
krsort($fruits);
foreach (
$fruits as $key => $val) { echo "$key = $val\n"; }
echo 
$hr;
print 
"\n$fc ksort</font> Sort an array by key\n\n";
ksort($fruits);
foreach (
$fruits as $key => $val) { echo "$key = $val\n"; }
echo 
$hr;
print 
"\n$fc rsort</font> Sort an array in reverse order\n\n";
rsort($fruits);
foreach (
$fruits as $key => $val) { echo "$key = $val\n"; }
echo 
$hr;
print 
"\n$fc sort</font> Sort an array\n\n";
sort($fruits);
foreach (
$fruits as $key => $val) { echo "$key = $val\n"; }
echo 
$hr;
print 
"\n$fc natsort</font> Sort an array using a \"<i>natural order</i>\" algorithm\n\n";
$array1 $array2 = array("img12.png""img10.png""img2.png""img1.png");
sort($array1);
echo 
"$fc Standard sorting</font>\n\n";
print_r($array1);
natsort($array2);
echo 
"\n$fc Natural order sorting</font>\n\n";
print_r($array2);
echo 
$hr;
print 
"\n$fc array_unique</font> Removes duplicate values from an array\n\n";
$input = array("a" => "green""red""b" => "green""blue""red");
print_r($input);
print 
"\n$fc Example #1 array_unique() example</font>\n\n";
$result array_unique($input);
print_r($result);
print 
"\n$fc Example #2 array_unique() and types</font>\n\n";
$input = array(4"4""3"43"3");
$result array_unique($input);
var_dump($result);
echo 
$hr;
print 
"\n$fc print_r</font> and$fc var_dump</font>\n\n";
print_r($fruits);
print 
"\n";
var_dump($fruits);
echo 
$hr;
?>
</pre>


www.softswot.com
Solutions through software innovation.
©2003