2,99 €
PHP is one of the most widespread and effective programming languages for the WEB and it is also very simple to understand. Moreover, we can find many free software to make the code we write run. The file to program in php must always have php extension, and it also supports all HTML tags. This text is aimed at beginners, long and complex examples are not used in order to learn faster without detracting from the effectiveness of what you learn and also makes sure that even the explanations are not long and boring doing so the reader is put in a position to learn directly by programming, since I think that programming as everything is learned by practicing it. All the examples in this text have been done to create safe and error-free examples.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
PHP
PHP is one of the most widespread and effective programming languages for the WEB and it is also very simple to understand. Moreover, we can find many free software to make the code we write run.
The file to program in php must always have php extension, and it also supports all HTML tags.
This text is aimed at beginners, long and complex examples are not used in order to learn faster without detracting from the effectiveness of what you learn and also makes sure that even the explanations are not long and boring doing so the reader is put in a position to learn directly by programming, since I think that programming as everything is learned by practicing it.
All the examples in this text have been done to create safe and error-free examples.
INDEX
1 Variables
2 Arithmetic operators
3 Comparison operators
4 Instruction if
5 Instruction if else
6 Array
7 The increment operator
8 The decrease operator
9 The for cycle
10 The while loop
11 Instruction break
12 Instruction continue
13 Take the values from a form
14 Instruction switch
15 Logical operators
16 Instruction exit
17 The rand function
18 Pick up the date from the server
19 Verify a numeric value
20 The function strlen
21 The foreach cycle
22 Instruction empty
23 Functions
24 Static Variables
25 The constants
26 Create a folder
27 Delete a folder
28 Take the IP address
29 Write and read files
30 Check to see if a file exists
31 Delete a file
32 Upload file
33 Session variables
34 Cookie
35 Turn characters into lowercase
36 Turn characters into uppercase
37 Format a number
38 Look for a value in an array
39 Instruction die
40 Interact with databases
41 Look for a value in a tables of a DB
42 Insert a record
43 Change a record
44 Delete a record
1)
Variables
Like all programming languages we find the variables, which are entities in which we will store our data as numbers, alphanumeric characters, etc.
In PHP to declare a variable, just precede it with the $ symbol.
Example:
<?php
echo ($Nome);
?>
We have assigned to the variable Name the string Mario, if we make this piece of code we see that the string will be printed.
The strings must be enclosed in double quotes as in the example.
Example 2:
<?php
echo ($Numero);
?>
With the second example, we declared a variable and assigned it the value of 20, then with the echo function we had it printed on screen.
As for the assignment of a value to a variable, we can also declare a variable and then assign it a value later.
Example:
<?php
$Nome;
$Nome=Mario
?>
2)
Arithmetic operators
The arithmetic operators as we all know are addition, subtraction, multiplication and division and module. Let's see what the symbols are and how they are used in PHP.
Sum of two numbers:
<?php
$Numero1=20;
$Numero2=10;
echo($Numero1 + $Numero2);
?>
Division of two numbers:
<?php
$Numero1=20;
$Numero2=10;
echo($Numero1 / $Numero2);
?>
Subtraction of two numbers:
<?php
$Numero1=20;
$Numero2=10;
echo($Numero1 - $Numero2);
?>
Multiplication of two numbers:
<?php
$Numero1=20;
$Numero2=10;
echo($Numero1 * $Numero2);
?>
Module between two numbers:
<?php
$Numero1=20;
$Numero2=10;
echo($Numero1 % $Numero2);
?>
In this case 0 will be returned.