Hi, Im Ac1d and this is my first PHP tut for darkmindz.com I simply wrote it for people to use as there we're any on the site and there was alot of demand for them. So this is going to be my first of many (hopefully) Lets Get Started... PHP stands for PHP: Hypertext Processor some people believe it means pre-hypertext processor but PHP.net states that it means "PHP: Hypertext Processor" Now. When using php you always have to start off with either a <?php or an <? Personally i use <?php for the main parts of scripts and <? for mini parts of a script that dont need noticing. Now The Basics. I'll Demonstrate a simple "hello world". <?php echo "Hello World"; ?> Note: You have to end all php scripts with ?>. Pretty simple eh? In, i think its C#, its a bit more complicated but this isnt a C# tutorial so i wont go into it lol. All PHP so called commands, are refered to as functions in the There is also another functions to show ASCII on a webpage. That function is print. The Syntax of the print function is identical to echo. I will not demonstrate the print as its just repeating the last one but with print instead of echo There is also one more way to show ASCII on a webpage, that is by using HEREDOC. A heredoc is pretty simple to understand, its making an echo easier to write . This is how it works. echo <<<EOF Nusquam Est Impossible Cogito Ergo Sum EOF; Now with the php tags around that it'd simple show 2 latin phrases (which i won't go into ) Now the arrows (<) need to be one space away from the echo function but the heredoc variable name (in our case EOF) needs to be touching the arrows (<). Now when using a heredoc you can use anything in place of EOF. I just used EOF as it's the example used on php.net. So if i wanted to use a heredoc to echo a form, and use it logically i could do something like this: <?php echo <<<FORM <form method="post"> <input type="text" name="name" value="Your Name Here"><br /> <input type="submit" value="Show Your Name"></form> FORM; ?> Now lets move on to variables.. to deifne a variable you have to start off with a $. Variables are used to store data for later use. For example a PHP web based Shell. Variables are constantly used to refer back to data stated in the variable. <?php $var = "This Is Variable Data"; echo $var; ?> Now in then above statement you can see that $var is the variable name. Text Is Stored in the "", only text though. Numbers are stored without the ""'s. Only one '=' is used. Its like saying this: $var is now to be shown as "This is variable data"; Showing the contents of a variable is very near to the first example of 'Hello World'. just remove the quotes and you can use a variable in its place. but you still have to end it with a ;. So hopefully now you know how variables work, how to create a simple hello world and how to retrieve the contents of a variable. Keep Your Eyes Open For My Next Tutorial, Thanx For Reading. Nusquam Est Impossible Ac1d
Tip : for better display, you can use the BB tags : which is better ? <?php if (1) echo 1; else die('Never reached'); ?> PHP: or <?php if (1) echo 1; else die('Never reached'); ?>