SlideShare a Scribd company logo
Server Side Scripting Language
10/29/2019By Girmachew Gulint (Mtech CSE) 1
A typical web server today contains four elements
in addition to the physical hardware.
LAMP (Linux, Apache, MySQL, and PHP)
WAMP (Windows, Apache, MySQL, & PHP)
XAMPP (Apache, MariaDB , Perl and PHP)
 PHP
 ASP
 Perl
PHP( Personal Home Page/Hypertext Preprocessor )
• Created in 1994 at the hands of Rasmus Lerdorf.
• a server-side language, which means it runs on the server before anything is sent to
the user’s computer.
Some advantages of server-side language
• Code is hidden from the user
• Secure what is take place in the background
• Reduce users computer load even through it needs powerful server.
10/29/2019By Girmachew Gulint (Mtech CSE) 2
WHY PHP
• PHP runs on numerous, varying platforms, including Windows, Linux, Unix, Mac
OS X, and so on.
• PHP is compatible with almost any modern server, such as Apache, IIS, and more.
• PHP supports a wide range of databases.
• PHP is free!
• PHP is easy to learn and runs efficiently on the server side.
• PHP is faster than other scripting language e.g. asp and jsp.
10/29/2019By Girmachew Gulint (Mtech CSE) 3
Syntax
Tag style Starting tag Ending tag
Standard <?php ?>
Short hand <? ?>
ASP <% %>
Script <script language=“php> </script>
10/29/2019By Girmachew Gulint (Mtech CSE) 4
php can be saved .php or embeded into html.
Example
• <?php
• echo “Hello world”;
• ?>
10/29/2019By Girmachew Gulint (Mtech CSE) 5
• <?
• echo “Hello world”;
• ?>
• <%
• echo “Hello world”;
• %>
PHP-Errors
1. Notice: noticing the programmer.
2. Warning : something has gone wrong during the execution of a script.
3. Error : unrecoverable(execution will stop); typically parsing error like
missing semicolon, function or other problem the engine does not know
how to resolve. Another category of error is logical error.
10/29/2019By Girmachew Gulint (Mtech CSE) 6
Send output to the browser
With PHP, there are two basic ways to get output: echo and print.
1. echo;
2. print();
• The differences : echo has no return value while print has a return value of
1 so it can be used in expressions.
• echo can take multiple parameters (although such usage is rare) while print
can take one argument. echo is marginally faster than print.
10/29/2019By Girmachew Gulint (Mtech CSE) 7
Comment
1. // single line comment
2. # this is also single line comment
3. /* multi line comment */
10/29/2019By Girmachew Gulint (Mtech CSE) 8
Variables
• Are special container of user defined values. Values can be number, string or
Boolean or other.
• Variables use to create template for operation.
• Variable consist name of your choosing preceded by $. (meaningful)
• Variable name can include letter, number and underscore but not include
space
• Variable must start by underscore or letter only
10/29/2019By Girmachew Gulint (Mtech CSE) 9
Example
Good variable Bad variable
$name $1name
$age $+age
$firstName $first name
$_salary $1a2a3a
10/29/2019By Girmachew Gulint (Mtech CSE) 10
Availability of variables
1. Local : their life time is inside function only.
2. global/ superglobal : accessible globally or superglobally.
10/29/2019By Girmachew Gulint (Mtech CSE) 11
Data types
• Different types of data take up different amounts of memory and may be
treated differently when they are manipulated in a script.
• Some programming languages therefore demand that the programmer
declare in advance which type of data a variable will contain. By contrast,
PHP is loosely typed, meaning that it will calculate data types as data is
assigned to each variable.
10/29/2019By Girmachew Gulint (Mtech CSE) 12
Continued
PHP supports 8 primitive data types that can be categorized further in 3 types:
• Scalar Types
• Compound Types
• Special Types
10/29/2019By Girmachew Gulint (Mtech CSE) 13
Data types
Scala data types Compound data types Special data types
Boolean Array Resource
Integer Object Null
Float
Double
String
10/29/2019By Girmachew Gulint (Mtech CSE) 14
gettype() and settype() or casting
• $name = “Girmachew “;
• gettype($name);// will output String
• //casting data type
• $number = 4.5;
• echo gettype($number);
• settype($number, 'string'); // converting into string
• echo gettype($number);
10/29/2019By Girmachew Gulint (Mtech CSE) 15
Constant
PHP constants are name or identifier that can't be changed during the
execution of the script. PHP constants can be defined by 2 ways:
• Using define() function
• Using const keyword
• PHP constants follow the same PHP variable rules. For example, it can be
started with letter or underscore only.
• Conventionally, PHP constants should be defined in uppercase letters.
10/29/2019By Girmachew Gulint (Mtech CSE) 16
PHP constant: define()
• Let's see the syntax of define() function in PHP.
define(name, value, case-insensitive)
Example
• <?php
• define("MESSAGE","Hello JavaTpoint PHP");
• echo MESSAGE;
• ?>
10/29/2019By Girmachew Gulint (Mtech CSE) 17
PHP constant: const keyword
• The const keyword defines constants at compile time. It is a language construct not a function.
• It is bit faster than define().
• It is always case sensitive.
• Example
• <?php
• const MESSAGE="Hello const by JavaTpoint PHP";
• echo MESSAGE;
• ?>
10/29/2019By Girmachew Gulint (Mtech CSE) 18

More Related Content

ODP
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...
PPT
Ijet Talk
PPT
Accessing loosely structured data from F# and C#
PPTX
F# and Financial Data Making Data Analysis Simple
ODP
PPTX
PHP ITCS 323
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...
Ijet Talk
Accessing loosely structured data from F# and C#
F# and Financial Data Making Data Analysis Simple
PHP ITCS 323

Similar to Server side scripting language (20)

PPTX
Introduction to webprogramming using PHP and MySQL
PPTX
Compiler design
PDF
chapter 5 Server-Side Scripting (PHP).pdf
PPTX
Putting Compilers to Work
PPT
Php intro
PPT
Php intro
PPT
Php intro
PPTX
Introduction to PHP.pptx
PPTX
Learn PHP Lacture1
PDF
The why and how of moving to php 8
PPT
02 intro
PPTX
Php intro
DOCX
Guidelines php 8 gig
PPT
Justmeans power point
PPT
Justmeans power point
PPT
Justmeans power point
PPT
Justmeans power point
PPT
Justmeans power point
PPT
Justmeans power point
Introduction to webprogramming using PHP and MySQL
Compiler design
chapter 5 Server-Side Scripting (PHP).pdf
Putting Compilers to Work
Php intro
Php intro
Php intro
Introduction to PHP.pptx
Learn PHP Lacture1
The why and how of moving to php 8
02 intro
Php intro
Guidelines php 8 gig
Justmeans power point
Justmeans power point
Justmeans power point
Justmeans power point
Justmeans power point
Justmeans power point
Ad

Recently uploaded (20)

PDF
Electronic commerce courselecture one. Pdf
PDF
Encapsulation theory and applications.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
cuic standard and advanced reporting.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
NewMind AI Weekly Chronicles - August'25-Week II
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
A Presentation on Artificial Intelligence
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Chapter 3 Spatial Domain Image Processing.pdf
Electronic commerce courselecture one. Pdf
Encapsulation theory and applications.pdf
Unlocking AI with Model Context Protocol (MCP)
cuic standard and advanced reporting.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Spectral efficient network and resource selection model in 5G networks
Network Security Unit 5.pdf for BCA BBA.
20250228 LYD VKU AI Blended-Learning.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
NewMind AI Weekly Chronicles - August'25-Week II
The AUB Centre for AI in Media Proposal.docx
MYSQL Presentation for SQL database connectivity
A Presentation on Artificial Intelligence
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
“AI and Expert System Decision Support & Business Intelligence Systems”
Advanced methodologies resolving dimensionality complications for autism neur...
Machine learning based COVID-19 study performance prediction
Chapter 3 Spatial Domain Image Processing.pdf
Ad

Server side scripting language

  • 1. Server Side Scripting Language 10/29/2019By Girmachew Gulint (Mtech CSE) 1 A typical web server today contains four elements in addition to the physical hardware. LAMP (Linux, Apache, MySQL, and PHP) WAMP (Windows, Apache, MySQL, & PHP) XAMPP (Apache, MariaDB , Perl and PHP)  PHP  ASP  Perl
  • 2. PHP( Personal Home Page/Hypertext Preprocessor ) • Created in 1994 at the hands of Rasmus Lerdorf. • a server-side language, which means it runs on the server before anything is sent to the user’s computer. Some advantages of server-side language • Code is hidden from the user • Secure what is take place in the background • Reduce users computer load even through it needs powerful server. 10/29/2019By Girmachew Gulint (Mtech CSE) 2
  • 3. WHY PHP • PHP runs on numerous, varying platforms, including Windows, Linux, Unix, Mac OS X, and so on. • PHP is compatible with almost any modern server, such as Apache, IIS, and more. • PHP supports a wide range of databases. • PHP is free! • PHP is easy to learn and runs efficiently on the server side. • PHP is faster than other scripting language e.g. asp and jsp. 10/29/2019By Girmachew Gulint (Mtech CSE) 3
  • 4. Syntax Tag style Starting tag Ending tag Standard <?php ?> Short hand <? ?> ASP <% %> Script <script language=“php> </script> 10/29/2019By Girmachew Gulint (Mtech CSE) 4 php can be saved .php or embeded into html.
  • 5. Example • <?php • echo “Hello world”; • ?> 10/29/2019By Girmachew Gulint (Mtech CSE) 5 • <? • echo “Hello world”; • ?> • <% • echo “Hello world”; • %>
  • 6. PHP-Errors 1. Notice: noticing the programmer. 2. Warning : something has gone wrong during the execution of a script. 3. Error : unrecoverable(execution will stop); typically parsing error like missing semicolon, function or other problem the engine does not know how to resolve. Another category of error is logical error. 10/29/2019By Girmachew Gulint (Mtech CSE) 6
  • 7. Send output to the browser With PHP, there are two basic ways to get output: echo and print. 1. echo; 2. print(); • The differences : echo has no return value while print has a return value of 1 so it can be used in expressions. • echo can take multiple parameters (although such usage is rare) while print can take one argument. echo is marginally faster than print. 10/29/2019By Girmachew Gulint (Mtech CSE) 7
  • 8. Comment 1. // single line comment 2. # this is also single line comment 3. /* multi line comment */ 10/29/2019By Girmachew Gulint (Mtech CSE) 8
  • 9. Variables • Are special container of user defined values. Values can be number, string or Boolean or other. • Variables use to create template for operation. • Variable consist name of your choosing preceded by $. (meaningful) • Variable name can include letter, number and underscore but not include space • Variable must start by underscore or letter only 10/29/2019By Girmachew Gulint (Mtech CSE) 9
  • 10. Example Good variable Bad variable $name $1name $age $+age $firstName $first name $_salary $1a2a3a 10/29/2019By Girmachew Gulint (Mtech CSE) 10
  • 11. Availability of variables 1. Local : their life time is inside function only. 2. global/ superglobal : accessible globally or superglobally. 10/29/2019By Girmachew Gulint (Mtech CSE) 11
  • 12. Data types • Different types of data take up different amounts of memory and may be treated differently when they are manipulated in a script. • Some programming languages therefore demand that the programmer declare in advance which type of data a variable will contain. By contrast, PHP is loosely typed, meaning that it will calculate data types as data is assigned to each variable. 10/29/2019By Girmachew Gulint (Mtech CSE) 12
  • 13. Continued PHP supports 8 primitive data types that can be categorized further in 3 types: • Scalar Types • Compound Types • Special Types 10/29/2019By Girmachew Gulint (Mtech CSE) 13
  • 14. Data types Scala data types Compound data types Special data types Boolean Array Resource Integer Object Null Float Double String 10/29/2019By Girmachew Gulint (Mtech CSE) 14
  • 15. gettype() and settype() or casting • $name = “Girmachew “; • gettype($name);// will output String • //casting data type • $number = 4.5; • echo gettype($number); • settype($number, 'string'); // converting into string • echo gettype($number); 10/29/2019By Girmachew Gulint (Mtech CSE) 15
  • 16. Constant PHP constants are name or identifier that can't be changed during the execution of the script. PHP constants can be defined by 2 ways: • Using define() function • Using const keyword • PHP constants follow the same PHP variable rules. For example, it can be started with letter or underscore only. • Conventionally, PHP constants should be defined in uppercase letters. 10/29/2019By Girmachew Gulint (Mtech CSE) 16
  • 17. PHP constant: define() • Let's see the syntax of define() function in PHP. define(name, value, case-insensitive) Example • <?php • define("MESSAGE","Hello JavaTpoint PHP"); • echo MESSAGE; • ?> 10/29/2019By Girmachew Gulint (Mtech CSE) 17
  • 18. PHP constant: const keyword • The const keyword defines constants at compile time. It is a language construct not a function. • It is bit faster than define(). • It is always case sensitive. • Example • <?php • const MESSAGE="Hello const by JavaTpoint PHP"; • echo MESSAGE; • ?> 10/29/2019By Girmachew Gulint (Mtech CSE) 18