Source Code
----------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------
<html>
<body>Welcome to my PHP Test Page
<?php /*Declaring and printing variables*/
$var = 5;
$name = "Hello World";
$test = array("Hello","this","is","an","array");
?>
<p>
Testing out, printing declared variables <br />
printing 5 to the screen from variable <?php print('$var ');?> <br /><br />
<?php print("$var");?> <br /><br />
Well that seemed to have worked out nicely, Now wth is the code to print print a newline. <br />
instead of having to use HTML's "br" to create a new line out of my php scope<br /><br />
Time to print a string using echo and print command<br />
<?php echo "$name"; print(" $name "); ?> <br /><br />
Time to print an array<br />
<?php print_r($test); ?><br />
Well that was really unexpected so much for that command being of any use.<br />
Maybe i used it wrong oh well time to find another way to print an array.<br />
<?php for($i = 0; $i<5; $i++){print("$test[$i] ");} ?><br /><br />
Well that seemed to have worked out a lot nicer. Using a loop and accessing each index of the array was nicer then print_r.<br />
I think I will end the tests for this blog. Thanks for reading!<br />
</p>
</body>
</html>
End of Source Code
What is actually displayed here. So you can see what exactly I did.
Welcome to my PHP Test Page
Testing out, printing declared variables
printing 5 to the screen from variable $var
5
Well that seemed to have worked out nicely, Now wth is the code to print print a newline.
instead of having to use HTML's "br" to create a new line out of my php scope
Time to print a string using echo and print command
Hello World Hello World
Time to print an array
Array ( [0] => Hello [1] => this [2] => is [3] => an [4] => array )
Well that was really unexpected so much for that command being of any use.
Maybe i used it wrong oh well time to find another way to print an array.
Hello this is an array
Well that seemed to have worked out a lot nicer. Using a loop and accessing each index of the array was nicer then print_r.
I think I will end the tests for this blog. Thanks for reading!
Wow, you actually made this really easy to follow. Hopefully this will be the start to a great tut!
ReplyDeleteThanks again!!
i like how you make it easy enough that its understandable even if you're not very good at programming
ReplyDeleteOne day I hope this blog will be a full featured php tutorial. thanks! hit me back up
ReplyDeletethis is a lot less confusing that math :D
ReplyDeleteyou could prolly teach to be honest.
ReplyDeletep.s. nice C cheat sheet thats nifty
you should help me with this stuff :)
ReplyDeleteI think you found your calling with intstructing. :)
ReplyDeleteThe fact that you gave the code, and then showed what it was supposed to look like seriously helped so much. It's a lot easier to follow along.
ReplyDeletefriends dont let other friends do php!
ReplyDeleteSmart man!
ReplyDeletedo you think maybe one day i'll be able to understand this mr.cheesey?
ReplyDeleteguh, i dont understand :O
ReplyDelete