tools:php
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tools:php [2024/06/03 03:24] – [Variables] Humphrey Boa-Gart | tools:php [2025/10/12 10:53] (current) – Humphrey Boa-Gart | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | {{wst> | + | # |
- | + | ||
- | ====== PHP ====== | + | |
- | + | ||
- | PHP is a server side language, meaning you can't see the source code in your browser, because all of the stuff is done on the server. To start, get some web hosting (easy) or start your own server (not as easy), and create a .php file. Having a decent knowledge of [[tools:html|HTML]] is highly recommended. If you've programmed in another web language such as ASP, or have knowledge of application | + | |
- | + | ||
- | ===== HELLO WORLD ===== | + | |
- | + | ||
- | Yeah... This is the ancient tradition of beginners starting out in any language. Here you go. | + | |
- | + | ||
- | <?php | + | |
- | echo "LOL HAI THER AMIDOINITRITE?"; | + | |
- | print(" | + | |
- | ?> | + | |
- | + | ||
- | Let's go over some rulez. (The word rules does not have a ' | + | |
- | + | ||
- | All PHP code starts with <?php and ends with ?>. These are called delimiters. echo is a statement that basically prints out whatever is in the double quotes. It isn't a function. (printf() is though.) Since echo is a statement, much like require/ | + | |
- | ==== Hello World, Again (with HTML) ==== | + | |
- | + | ||
- | We saw how echo can output text. But it can also output HTML code and JavaScript. Example here. | + | |
- | + | ||
- | <?php | + | |
- | echo "< | + | |
- | ?> | + | |
- | + | ||
- | This' | + | |
- | ===== Variables ===== | + | |
- | + | ||
- | Now we'll learn a little about variables. PHP is great because, unlike other languages, you don't need to specify what type of variable you are declaring (integer, Boolean, float, string, etc). PHP automatically identifies the type for you. Anyway, here we go. | + | |
- | + | ||
- | <?php | + | |
- | $lolvar = 6; | + | |
- | $loldecimal = 3.12; | + | |
- | $lolstring = "This is a string."; | + | |
- | echo $lolvar; | + | |
- | echo $loldecimal; | + | |
- | echo $lolstring; | + | |
- | ?> | + | |
- | + | ||
- | Some things to note: | + | |
- | + | ||
- | ALL VARIABLES START WITH THE DOLLAR SIGN ($) NO EXCEPTIONS When echoing a variable you don't need the double quotes You can also concatenate, | + | |
- | + | ||
- | <?php | + | |
- | $lol = " | + | |
- | $wut = " | + | |
- | $randomdigit = 2; | + | |
- | echo "Did you just use the meme " . $lol . " " . $wut . " " .$randomdigit . " times?"; | + | |
- | ?> | + | |
- | + | ||
- | This' | + | |
- | ==== Constants ==== | + | |
- | + | ||
- | ===== Predefined variables ===== | + | |
- | + | ||
- | ==== Types of variables ==== | + | |
- | + | ||
- | ===== Operators ===== | + | |
- | + | ||
- | ==== Arithmetic ==== | + | |
- | + | ||
- | ==== Assignment ==== | + | |
- | + | ||
- | ==== Logical ==== | + | |
- | + | ||
- | ==== Comparison ==== | + | |
- | + | ||
- | ==== Conditional statements and loops ==== | + | |
- | + | ||
- | ==== Conditional statements ==== | + | |
- | + | ||
- | ==== If ==== | + | |
- | + | ||
- | ==== Switch ==== | + | |
- | + | ||
- | ===== Loops ===== | + | |
- | + | ||
- | ==== For loops ==== | + | |
- | + | ||
- | ==== Foreach loops ==== | + | |
- | + | ||
- | ==== While loops ==== | + | |
- | + | ||
- | ==== Do-while loops ==== | + | |
- | + | ||
- | ==== Simple Backdoor in PHP ==== | + | |
- | + | ||
- | ==== Email flooder in PHP ==== | + | |
- | + | ||
- | ===== Image bugs ===== | + | |
- | + | ||
- | {{tag> | + |
tools/php.1717385090.txt.gz · Last modified: (external edit)
Find this page online at: https://bestpoint.institute/tools/php
Find this page online at: https://bestpoint.institute/tools/php