PHP is a programming language with which most IT and CS students are familiar. This scripting language works with HTML plus and is used for creating and enhancing websites. When doing a course in PHP language, students are required to complete several assignments writing tasks to prove their skills. But they generally find PHP assignments difficult to solve because of the complex nature of the subject. And the one who dares to do it on their own, often end up submitting them late. To help these kinds of students, here is a PHP cheat sheet which will help them write the assignments quickly. This cheat sheet is prepared by our PHP assignment writing experts.
PHP Cheat Sheet for Beginners to Use in Their Assignments
PHP Operators
Mathematics Operators
= // Basic Assignment;
+= // Addition;
-= // Subtraction;
*= // Multiplication;
/= // Division;
%= // Modulus;
Comparison Operators
== // Equal
=== // Identical
!= // Not Equal
<> // Not Equal
!== // Not Identical
> // Greater Than
< // Less Than
>= // Greater than or Equal To
<= // Less than or Equal To
Increment-Decrement Operators
++$variable // Pre-Increment
$variable++ //Post Increment
--$variable // Pre-Decrement
$variable-- // Post Decrement
Logical Operators
And // true if both are true
Or // true if either are true
Xor // true if either are true but not both
&& // true if both are true
|| // true if either are true
! // true if not true
Functions
time(); // Current Unix Timestamp
date(); // Formats Date/Time
strtotime(); // Parses to Timestamp
include("");
require("");
mail(to,subject,message);
PHP Conditions and Loops
if (condition) { action }
elseif (condition) { action }
else { action }
switch (1st half of condition) {
case "2nd half of condition":
action
break;
default:
action
break;
}
while (condition) {
action
increment condition variable
}
do {
action
increment condition variable
}
while (condition);
for (initialize; condition; increment)
{ action to take }
File Functions in PHP
fopen(filename, method);
feof(filehandle);
fgets(filehandle);
filesize(filename);
fread(filehandle, filesize);
fwrite(filehandle, filedata);
fclose(filehandle)
unlink(filename);
String Manipulation in PHP
< ? php
$variable = "Sam Hemsworth is a Creep";
str_replace("Dork", "God", $variable); // replace Creep with God
echo strtoupper($variable); // Capitalize all letters
echo ucwords($variable); // Capitalize first letter of all words
echo strtolower($variable); // Lowercase all letters
echo lcfirst($variable); // Lowercase only first word
echo
?>
While Loop
< ? php
$counter = 0;
while ($counter < 10) {
echo $counter;
$counter++;
}
?>
Arrays
< ? php
// Numeric Array
$my_array = array("Blue", "Red", "Green", "Purple");
Echo $my_var[0]; // echoes out Blue
?>
< ? php
// Associative Arrays
$ages = array("John"=>"39", "Bob"=>"18", "Mary"=>"29");
echo $ages["John"]; // echoes out 39
?>
If / Else / Elseif Statements
< ? php
if (condition) {
// do something
} elseif (condition) {
// do something
} else {
// do something
}
?>
Example:
< ? php
if ($variable > 100) {
echo "Your variable is greater than 100";
} elseif ($variable == 150) {
Echo "Your variable is 150!";
} else {
"Your number is less than 100";
}
?>
So, this was the complete cheat sheet for students whose PHP assignment is due. Don’t forget to bookmark this page for future references. Now you don’t need to scour over the internet to look for tricks, tips, and shortcuts for your PHP assignment. Just refer to this amazing cheat sheet. PHP assignments take time to get done so start as soon as possible and if by any chance you feel that you will not be able to complete it then you can anytime contact us through email, phone, and our mobile app.
USD6
-
Topic CreationUSD 3.87
-
OutlineUSD 9.33
-
Unlimited RevisionsUSD 20.67
-
Editing/ProofreadingUSD 28
-
FormattingUSD 8
-
BibliographyUSD 7.33