0% found this document useful (0 votes)
56 views2 pages

Experiment 14 Scripting

The document discusses server-side scripting languages and control statements in PHP. It explains that server-side scripts run on a web server and are not viewable by the public, unlike client-side scripts. PHP includes control statements like if, if/else, if/else if, and switch statements. It also covers for loops in PHP, which are used to execute a block of code a specific number of times. The aim of the experiment is to illustrate the use of control statements in server-side PHP scripts.

Uploaded by

Anvay Gorule
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views2 pages

Experiment 14 Scripting

The document discusses server-side scripting languages and control statements in PHP. It explains that server-side scripts run on a web server and are not viewable by the public, unlike client-side scripts. PHP includes control statements like if, if/else, if/else if, and switch statements. It also covers for loops in PHP, which are used to execute a block of code a specific number of times. The aim of the experiment is to illustrate the use of control statements in server-side PHP scripts.

Uploaded by

Anvay Gorule
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

PCPF EXPERIMENT NO – 14

AIM : Illustrate the use of control statements in the server side script

THEORY :
Scripting language (also known as scripting, or script) is plainly defined as a series of commands
that are able to be executed without the need for compiling. While all scripting languages are
programming languages, not all programming languages are scripting languages. PHP, Perl, and
Python are common examples of scripting languages.

Scripting languages use a program known as an interpreter to translate commands and are directly
interpreted from source code, not requiring a compilation step. Other programming languages, on
the other hand, may require a compiler to translate commands into machine code before it can
execute those commands.

There are two types of scripting languages : server side and client side. The only significant
difference between the two is that the former requires a server for its processing. 

Server-side scripting languages run on a web server. When a client sends a request, the server
responds by sending content via HTTP. In contrast, client-side scripting languages run on the client
end on their web browser.

The benefit of client-side scripts is that they can reduce demand on the server, allowing web pages
to load faster. Whereas, one significant benefit of server-side scripts is they are not viewable by the
public like client-side scripts are.

When trying to decide which way to go on a project, keep in mind that client-side scripting is more
focused on user interface and functionality. Conversely, server-side scripting focuses on faster
processing, access to data, and resolving errors.

There are many benefits to using scripting languages over other programming languages. First,
they are open-source. This allows users from around the world to join in the improvement process.
Other pros include :

 No requirement to compile, although occasionally it is necessary.

 Easy to transfer between operating systems.


 Scripting languages make web pages look awesome.

 Easier to learn and write.


 Scripts can be used as a prototype to programs, saving time on test projects.

There are not a whole lot of cons to using scripting languages. One con is the fact that some
companies don’t want scripts to be read by everyone, so they use server-side scripts to avoid
releasing them to the public. Also, installing an interpreter program can be a hassle. Finally,
sometimes scripts are slower than programs.

Like all other languages, PHP provides a few control statements enabling developers to develop
different logic to execute in different conditions. PHP core includes the control statements:

 if
 if else
 if else if
 Switch statement

Looping in PHP : for loop

Generally, the for loop is used to execute a piece of code a specific number of times. In other
words, if you already know the number of times you want to execute a block of code, it's
the for loop which is the best choice.

Syntax :

for (expr1; expr2; expr3)

  // code to execute

The expr1 expression is used to initialize variables, and it's always executed. The expr2 expression is


also executed at the beginning of a loop, and if it evaluates to true, the loop code is executed.
After execution of the loop code, the expr3 is executed. Generally, the expr3 is used to alter the
value of a variable which is used in the expr2 expression.

CODE :

OUTPUT:

CONCLUSION:

You might also like