•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 363,779 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,548 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
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!"); */ ?>
Post Comment
•
•
•
•
DaniWeb Marketplace (Sponsored Links)