We are building EduLadder(ELADR) - Protocol

The Eladr Protocol is a decentralized, security and efficiency enhanced Web3 noSQL database powered by IPFS as the data storage layer https://ipfs.io/, and the Cardano block chain as the rewards token platform, https://cardano.org/. It provides a JSON based, IPFS layer 2 solution for data indexing and retrieval in an 'append only' file system built with open source Node.js API libraries.

The ELADR token was designed to incentivize and reward community members as a proof of contribution. Token holders are also granted access to EduLadder.com premium features as well as associated ELADR token enabled apps.


Real Problems! Real Experts!

Join Our Telegram Channel !

The Eduladder is a community of students, teachers, and programmers. We help you to solve your academic and programming questions fast.
In eduladder you can Ask,Answer,Listen,Earn and Download Questions and Question papers.
Watch related videos of your favorite subject.
Connect with students from different parts of the world.
Apply or Post Jobs, Courses ,Internships and Volunteering opportunity. For FREE
See Our team
Wondering how we keep quality?
Got unsolved questions? Ask Questions

You are here:Open notes-->Programming-languages-->PHP


How to study this subject

Add contents here

Official Notes

What is PHP?
PHP is an recursive acronym for "PHP: Hypertext Preprocessor"
PHP is a widely-used, open source (free to download, use, modify and rerelease)
scripting language
PHP scripts are executed on the server. – server side scripting language
PHP History
➢ PHP was developed by Rasmus Lerdorf for monitoring his online resume in 1995. It 
slowly became popular. This first version PHP/F1 has some basic functions.
➢ PHP/F1 2.0 was released and was quickly replaced by PHP 3.0 in 1997
➢ PHP 3.0 was interesting. It was developed by and Andi Gutmans and Zeev suraski. It 
includes support for wider range of data bases (Oracle and My SQL). This version had 
greater portability. It was used by thousands of web servers.
➢ PHP 4.0 was released in 2003. It used a new engine and provided better performance, 
greater reliability and scalability and support for web servers other than Apache. It also 
supports OOP features and built-in session management.
➢ PHP 5.0 offers a complete object oriented program models. It also includes better 
exception handling, a more consistent XML tool kit, improved My SQL support and a 
better memory manager. PHP 5.0 was the best in the languages 10 year history. A 
survey was conducted by net craft in April 2004. It showed that PHP was in use for over 
15 million websites. 
Features of PHP
PHP as a programming language for the web has many advantages than JSP, ASP and 
VB.NET. Because of its simplicity and open source availability it is the widely used scripting 
language for websites. The features of PHP that are listed below makes PHP the most 
enjoyable language for the developer community.
Even a beginner can easily to learn PHP because it has
➢ Clearly written manual
➢ Consistent and logical syntax
➢ It may take only two hours for a programmer to learn PHP and write scripts. 
➢ It has Kiss principle for (Keep it simple stupid) rapid application development.
➢ It can also access c library and take advantage of that code.
The PHP scripts can be made to work on different platformsfrom PHP 3.0 This is 
because PHP code is interpreted not compiled.The meaning of this portability is developer can 
write code on windows and deploy on Unix with interpreter for PHP. PHP scripts can be run on 
Microsoft windows, Unix, Mac OS and OS/2.
PHP scripts run faster that most scripting languages like ASP, JSP and Perl. when PHP 
4.0 was released it had new parsing engine which made it faster. PHP 5.0 was even faster 
through the use of optimized memory manager and object handler.

Open source
Since PHP is open source, its source code is freely available on the web. We need not 
pay any license. So cost of developed website application is reduced but reliability and 
performance is not affected. This open-source approach also makes the application to fix bug 
The language is set to be extensible, it can support new technology and add new 
methods to it. PHP create has built-in architecture which allows developers easily add new 
technologies and modules.
Example of add on modulus:-
➢ Dynamically create images
➢ PDF and SWF files
➢ Connect to IMAP and POP 3
➢ Interface with my SQL, oracle, postqre SQL & SQ lite
➢ Handle electronic payments
➢ Pass ML documents
➢ Execute perl, java, com.code
What is a PHP File?
PHP files can contain text, HTML, CSS, JavaScript, and PHP code
PHP codes are executed on the server, and the result is returned to the browser as plain 
PHP files have extension ".php"
What Can PHP Do?
➢ PHP can generate dynamic page content
➢ PHP can create, open, read, write, delete, and close files on the server
➢ PHP can collect form data
➢ PHP can send and receive cookies
➢ PHP can add, delete, and modify data in database
➢ PHP can be used to control user-access
➢ PHP can encrypt data
➢ PHP is not limited to output HTML. We can output images, PDF files, and even Flash 
movies. We can also output any text, such as XHTML and XML.
Why PHP?
PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
PHP is compatible with almost all servers used today (Apache, IIS, etc.)
PHP supports a wide range of databases
PHP is free. Download it from the official PHP resource: www.php.net
PHP is easy to learn and runs efficiently on the server side
What's new in PHP 7
PHP 7 is much faster than the previous popular stable release (PHP 5.6)
PHP 7 has improved Error Handling
PHP 7 supports stricter Type Declarations for function arguments
PHP 7 supports new operators (like the spaceship operator: <=>)
PHP statements and comments
A PHP script consists of one or more statements, with each statement ending with a 
semicolon. Blank lines within the script are ignored by the parser. Everything outside the tags is 
also ignored by the parser, and returned as it; only the code between the tags is read and 
executed. The semicolon can be omitted on the last line of a PHP block, because the closing ?> 
includes an implicit semicolon. 
For greater readability, we should add comments to our PHP code.
There are three comment styles listed here:
// this is a single-line comment
# so is this
/* and this is a
comment */
Variables are the building blocks of any programming language. A variable can be 
thought of as a programming construct used to store both numeric and nonnumeric data. The 
contents of a variable can be altered during program execution, and variables can be 
compared and manipulated using operators.
PHP supports a number of different variable types—Booleans, integers, floating point 
numbers, strings, arrays, objects, resources, and NULLs—and the language can automatically 
determine variable type by the context in which it is being used. Variables need not be 
declared. Every variable has a name, which is preceded by a dollar ($) symbol, and it must 
begin with a letter or underscore character, optionally followed by more letters, numbers, and 
underscores. For example, $popeye, $one_day, and $INCOME are all valid PHP variable names, 
while $123 and $48hrs are invalid variable names.
Variable names in PHP are case-sensitive; $count is different from $Count or $COUNT.
Saving form input in variable
PHP can be used for creating dynamic websites. In a dynamic website, user can interact 
with website by providing text or by selecting options. Form is one of the quickest and easiest 
ways to add interactivity to our website. Through forms we can read user data into PHP 
Sample form
< html>
< head></ head>
< body>
< farm action=" message . PHP" method =" post">
Enter your message:< input type=" text" name=" MSG"=" 30">
< input type=" submit" value=" send ">
</ form>
</ body>
</ html>
Message. php
<? PHP
// retrieve form data in a variable
$input=$- post[" MSG"];
// print it
echo " you said <i> $input </i>”
You said: Hello
We use two files (html and PHP files) for retrieving a single text data got from a user in 
a web form into php variable $input. The web page is displayed with the message Enter 
yourmessage: In the text box near the message, the user will type some message in few words 
after the text box there will be a submit button. After entering the message in the text box 
user will click submit bottom. When submit button is clicked the PHP script message.php is 
executed and the message displayed will be the text entered by the user.
Here we have used HTML coding for displaying the input box. The <form> tag of html is 
used with input option. The form tag also contains two main attributes action and method. 
The action attribute specifies the name of the script. Here the name is message.php. The script 
will process the message entered into the form. The method attribute of the < form> tag 
specifies the manner in which form data will be submitted. Here it is POST method.
We have to run the home.html file in a browser. This is a client side script. On running 
this file a form is displayed in the webpage with a line.
When we click the submit button the server side script in the action attribute will be 
called for execution. That script will display another webpage that prints the string we have 
entered.The $_POST variable would have stored the string we have entered. It will be stored
in$_POST[‘msg’]. Then it will be assigned to php variable $input.We can display it using echo 
A constant is used to store fixed values.We can declare and use constants using define()
The syntax is
define (" constant name", value);
define (" gold price",3800);
define (" PI",3.14)
We can use just like a variable. The only difference is the variable will start with $ sign and a 
constant doesn’t have $ sign.The constant name can have small letters (lower case)
There are some predefined built-in PHP variables and constants:-
The function phpinfo() displays all the variables and constant.
There are 6 basic scope rules.
➢ Built-in super doper Global variables are visible everywhere within the script.
➢ Constants once declared is always visible globally.
➢ Global variables in a script are visible throughout the script but not inside function.
➢ Variables inside function that are declared Global refers to global variable of same 
➢ Variables created inside function and declared as static are invisible from outside the 
➢ Variable created inside function are local to the function and stops to exist when the 
function terminate.
PHP provides the set of operators for performing arithmetic, relational, logical and 
string operations.
Arithmetic operators:
Operator symbol Meaning
+ Addition 
_ Subtraction
* Multiplication
/ Division
% Division remainder 
= Assignment
Relational operator:
Operator Symbol Meaning
< Less than
<= Less than equal to
> Greater than
>= Greater than equal to
= = equal to
= = = Equal to and of same type
! = = Not equal to or not of same 
<> aka ! = Not equal to
Logical operator:
Operator Symbol Meaning
&& Logical AND
|| Logical OR
XOR Logical XOR
! Logical not
Other operators:
Operator Symbol Meaning
. String contraction
.= Concatenation and 
++ Auto increment 
+= Increment and assignment
-- Auto decrement
-= Decrement and assignment

Notes from other sources

Add contents here

Model question papers

Add contents here

Previous year question papers

Add contents here

Useful links

Add contents here