Starers Script

Killer_Typo Killer_Typo is offline Offline Sep 20th, 2004, 12:24 pm |
0
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.
Quick reply to this message  
PHP Syntax
  1. <?php
  2. /////////////////////////////////////////////////////
  3. //Block of code is testing for a switch, to view ////
  4. //the test just remove the /* and */ and the ////////
  5. //begining and ending of this code block/////////////
  6. /////////////////////////////////////////////////////
  7. /*
  8.  
  9. echo "The expression x <= 3 while x=1 is to be evaluated <br />";
  10. echo "The values of x are to be printed using a case switch <br />";
  11. for($x = 1; $x <= 3; $x++)
  12. {
  13.  
  14. switch ($x)
  15. {
  16. case 1:
  17. echo "Number is ";
  18. echo $x;
  19. echo "<br />";
  20. break;
  21. case 2:
  22. echo "Number is ";
  23. echo $x;
  24. echo "<br />";
  25. break;
  26. case 3:
  27. echo "Number is ";
  28. echo $x;
  29. echo "<br />";
  30. break;
  31. default:
  32. echo "Numbers is not between 1 and 3 <br />";
  33. break;
  34. }
  35.  
  36.  
  37. }
  38. */
  39.  
  40. /*
  41. /////////////////////////////////////////////////
  42. //Will print the vallues of a given array////////
  43. /////////////////////////////////////////////////
  44. $arr=array("one", "two", "three");
  45.  
  46. foreach ($arr as $value)
  47. echo "Value: " . $value . "<br />";
  48. */
  49.  
  50.  
  51. /////////////////////////////////////////////////
  52. //Code to output where the user came from and////
  53. //The IP along with their Browser Version////////
  54. /////////////////////////////////////////////////
  55.  
  56. /*
  57. echo "Referer: " . $_SERVER['HTTP_REFERER'] . "<br />";
  58. echo "Browser: " . $_SERVER['HTTP_USER_AGENT'] . "<br />";
  59. echo "IP Add: " . $_SERVER['REMOTE_ADDR'] . "<br />";
  60. */
  61. //////////////////////////////////////////////////
  62. //Testing the fopen() function////////////////////
  63. //////////////////////////////////////////////////
  64. /*
  65. $f=fopen ("welcome.txt","r+");
  66. */
  67. /*
  68. if (!($f=fopen("welcomez.txt","r")))
  69. exit ("unable to open file!");
  70. */
  71. ?>

Message:


Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC