Starers Script

Killer_Typo 0 Tallied Votes 146 Views Share

I got bored and started some scripting the other day in PHP, this is just a sample that i wrote, just uncomment the part of script that you would like to see. IE remove the /* and */ around a certain area. i know its not great, but some beginners might find this a little helpful.

<?php
/////////////////////////////////////////////////////
//Block of code is testing for a switch, to view ////
//the test just remove the /* and */ and the ////////
//begining and ending of this code block/////////////
/////////////////////////////////////////////////////
/*

echo "The expression x <= 3 while x=1 is to be evaluated <br />";
echo "The values of x are to be printed using a case switch <br />";
for($x = 1; $x <= 3; $x++)
{

switch ($x)
{
case 1:
echo "Number is ";
echo $x;
echo "<br />";
break;
case 2:
echo "Number is ";
echo $x;
echo "<br />";
break;
case 3:
echo "Number is ";
echo $x;
echo "<br />";
break;
default:
echo "Numbers is not between 1 and 3 <br />";
break;
}


}
*/

/*
/////////////////////////////////////////////////
//Will print the vallues of a given array////////
/////////////////////////////////////////////////
$arr=array("one", "two", "three");

foreach ($arr as $value)
echo "Value: " . $value . "<br />";
*/


/////////////////////////////////////////////////
//Code to output where the user came from and////
//The IP along with their Browser Version////////
/////////////////////////////////////////////////

/*
echo "Referer: " . $_SERVER['HTTP_REFERER'] . "<br />";
echo "Browser: " . $_SERVER['HTTP_USER_AGENT'] . "<br />";
echo "IP Add: " . $_SERVER['REMOTE_ADDR'] . "<br />";
*/
//////////////////////////////////////////////////
//Testing the fopen() function////////////////////
//////////////////////////////////////////////////
/*
$f=fopen ("welcome.txt","r+");
*/
/*
if (!($f=fopen("welcomez.txt","r")))
exit ("unable to open file!");
*/
?>
Member Avatar for LastMitch
LastMitch

@Killer_Typo

Nice code but it doesn't work properly now.

I know it's 8 years too late.

Can you update line 57 to line 59.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.