Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 278 Vote(s) - 3.4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[CashFX] PHP Tutorial #1 - The Basics

#1
[Image: Tl3xIiy.png]
HOSTED BY CASHFX

Tutorial #1 - PHP Basics

So, my first tutorial! Woo! I thought I'd give something back! YAY! This is the way I learned PHP, and I'm stupid. So hopefully, you'll be able to understand it! :biggrin:

Anyway, I hate huge intro's, let's just get stuck in :smile:

This tutorial does assume that you know basic HTML. I will probably post tutorials on that at a later date, but no promises.

PHP uses a

[To see links please register here]

similar to objective C and Perl, however it does look more like Java.

Semicolons
PHP Code:
$i += 15
PHP uses semicolons to end commands. The most common cause of error is simply forgetting to put in a semicolon.
Why are they used? Well, the server would have to try to differentiate the end of one command and the start of another, whereas with semicolons, you tell it. It speeds up the formatting of the page the server will send out (parsing).

The '$' Sign
The $ sign is used across many programming languages, some for different purposes, but is usually quite fundamental. A '$' should be placed in front of a variable. Why? Because, again, it makes the PHP parse faster.
An example of this would be:
PHP Code:
<?php
$stringhere 
"This is some text";
echo 
$stringhere;
?>

Types of variable
So, there are three main types of variables in PHP:
  • String
  • Integer
  • Array
These are the most common, but are not limited - there are other types such as two-dimentional arrays, but for the purposes of what we are going to cover, it's not essential to know others quite yet.

What is a string? Well, a string is a set of characters that are text, such as 'Hello, I'm McDork'. When defining a string, the text should always be enclosed in speech marks:
PHP Code:
$hello "This is my string"

What is an integer? An integer is a number. These don't need to be enclosed in speech marks:
PHP Code:
$mynumber 123

What is an array? Well, let's say you have 5 things you want to store, such as names in the variable $names. You would have to create an array:
PHP Code:
$names = array('Joe''Jack''James''Windox''Peter'); 
These names are now together in one array. You can now call back any name you like by doing the following:
PHP Code:
echo $names[0]; 
- This will return the name Joe.
PHP Code:
echo $names[2]; 
- This will return the name James.
PHP Code:
echo $names[4]; 
- This will return the name Peter.

*REMEMBER* Indexing for arrays start at 0! (Thanks VipVince - my mistake!)

Arithmetic operators.
Now, you will be thinking, I'm not gonna do any math! Oh yeah you are. When handling data, you will always find a situation where you will need to be using some mathematical operator.
Here they are:
  • + Addition
  • - Subtraction
  • * Multiplication
  • / Division
  • % Modulus (division remainder)
  • ++ Increment
  • -- Decrement

If you don't know what any of those words mean, use google. I'm not here to teach maths :wink:

There are other types of operator such as Assignment or Comparison operators, however, we will get onto those in later tutorials.

Anyway, if I've bored you enough, I can assure you, that that's it will get better, and you will be able to come up with a functioning website that does quite complex things by the end of this tutorial series.



Reply

#2
Thanks for the tutorial bro. I'll need this if I want to enhance my PPD websites lol. I learned how to do the referral link thing though ;D
Reply

#3
Thanks for the doughnut!

Loads of people will find this useful, especially beginners.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through