0% found this document useful (0 votes)
7 views14 pages

Difference Between Client

The document compares client-side and server-side scripting, highlighting that client-side scripting is visible to users and runs on their browsers, while server-side scripting is hidden and executed on the web server. It also evaluates PHP as a server-side scripting language, noting its open-source nature, ease of use, and compatibility with various databases. Additionally, it covers PHP's features, syntax, variables, and constants, emphasizing its performance, security, and community support.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views14 pages

Difference Between Client

The document compares client-side and server-side scripting, highlighting that client-side scripting is visible to users and runs on their browsers, while server-side scripting is hidden and executed on the web server. It also evaluates PHP as a server-side scripting language, noting its open-source nature, ease of use, and compatibility with various databases. Additionally, it covers PHP's features, syntax, variables, and constants, emphasizing its performance, security, and community support.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Difference between client-side scripting and server-side scripting :

Client-side scripting Server-side scripting

Source code is not visible to the user because its output


Source code is visible to the user.
of server-sideside is an HTML page.

Its main function is to provide the requested output to the end Its primary function is to manipulate and provide access to the respective database
user. as per the request.

In this any server-side technology can be used and it does not


It usually depends on the browser and its version.
depend on the client.

It runs on the user’s computer. It runs on the webserver.

There are many advantages linked with this like faster.


The primary advantage is its ability to highly customize, response
response times, a more interactive application.
requirements, access rights based on user.

It does not provide security for data. It provides more security for data.

It is a technique used in web development in which scripts run It is a technique that uses scripts on the webserver to produce a response that is
on the client’s browser. customized for each client’s request.

HTML, CSS, and javascript are used. PHP, Python, Java, Ruby are used.

No need of interaction with the server. It is all about interacting with the servers.

It reduces load on processing unit of the server. It surge the processing load on the server.
Features Server-side Scripting Client-side Scripting

Primary The main function of this scripting is to manipulate and grant The main purpose of this scripting is to give the
Function access to the requested database. requested output to the end-user.

Uses It is employed at the backend, where the source code is invisible It is utilized at the front end, which users may view
or concealed on the client side. through the browser.

Processing It needs server interaction. It doesn't need any server interaction.

Security It is more secure while working on a web app. It is less secure than server-side scripting due to the
code accessibility offered to the client.

Running It executes on the web server. It executes on the remote computer system.

Dependability It doesn't depend on the client. It depends on the user's browser version.

File Access It offers complete access to the file that is stored in the web It doesn't offer any access to the files on the web servers.
database server.

Code Allowance It enables the backend developer to hide the source code from The user is given access to the written code after
the user. confirming their requirements.

Occurrence It only responds after the user begins the browsing request. It happens when the browser processes all of the codes
and then acts according to the client's needs.

Affect It may reduce the server load. It may effectively customize web pages and offer
dynamic websites.

Languages The server-side scripting programming languages, such as PHP, Its programming languages are HTML, CSS, and
Involved ColdFusion, Python, ASP.net, Java, C++, Ruby, C#, etc. JavaScript.
EVALUATION OF PHP
The term PHP is an acronym for PHP: Hypertext Preprocessor. PHP is a server-side scripting language designed
specifically for web development. It is open-source which means it is free to download and use. It is very simple to
learn and use. The files have the extension “.php”.
Rasmus Lerdorf inspired the first version of PHP and participated in the later versions. It is an interpreted language
and it does not require a compiler.
• PHP code is executed in the server.
• It can be integrated with many databases such as Oracle, Microsoft SQL Server, MySQL, PostgreSQL, Sybase, and
Informix.
• It is powerful to hold a content management system like WordPress and can be used to control user access.
• It supports main protocols like HTTP Basic, HTTP Digest, IMAP, FTP, and others.
• Websites like www.facebook.com and www.yahoo.com are also built on PHP.
• One of the main reasons behind this is that PHP can be easily embedded in HTML files and HTML codes can also
be written in a PHP file.
• The thing that differentiates PHP from the client-side language like HTML is, that PHP codes are executed on the
server whereas HTML codes are directly rendered on the browser. PHP codes are first executed on the server
and then the result is returned to the browser.
• The only information that the client or browser knows is the result returned after executing the PHP script on
the server and not the actual PHP codes present in the PHP file. Also, PHP files can support other client-side
scripting languages like CSS and JavaScript.
PHP Features
PHP is very popular language because of its simplicity and open source. There are some important features of
PHP given below:
Performance:

PHP script is executed much faster than those scripts which are written in other languages such as JSP and
ASP. PHP uses its own memory, so the server workload and loading time is automatically reduced, which results
in faster processing speed and better performance.

Open Source:

PHP source code and software are freely available on the web. You can develop all the versions of PHP
according to your requirement without paying any cost. All its components are free to download and use.

Familiarity with syntax:

PHP has easily understandable syntax. Programmers are comfortable coding with it.

Embedded:

PHP code can be easily embedded within HTML tags and script.

Platform Independent:

PHP is available for WINDOWS, MAC, LINUX & UNIX operating system. A PHP application developed in one
OS can be easily executed in other OS also.

Database Support:

PHP supports all the leading databases such as MySQL, SQLite, ODBC, etc.

Error Reporting -
PHP has predefined error reporting constants to generate an error notice or warning at runtime. E.g., E_ERROR,
E_WARNING, E_STRICT, E_PARSE.

Loosely Typed Language:

PHP allows us to use a variable without declaring its datatype. It will be taken automatically at the time of
execution based on the type of data it contains on its value.

Web servers Support:

PHP is compatible with almost all local servers used today like Apache, Netscape, Microsoft IIS, etc.

Security:

PHP is a secure language to develop the website. It consists of multiple layers of security to prevent threads
and malicious attacks.

Control:

Different programming languages require long script or code, whereas PHP can do the same work in a few
lines of code. It has maximum control over the websites like you can make changes easily whenever you want.
A Helpful PHP Community:

It has a large community of developers who regularly updates documentation, tutorials, online help, and FAQs.
Learning PHP from the communities is one of the significant benefits.
Basic Syntax:-

All PHP code goes between the php tag. It starts with <?php and ends with ?>. The syntax of PHP
tag is given below:

1. <?php
2. //your code here
3. ?>

Let's see a simple PHP example where we are writing some text using PHP echo command.
File: first.php

<!DOCTYPE>

<html>
<body>
<?php
echo "<h2>Hello First PHP</h2>";
?>
</body>
</html>

Output:

Hello First PHP


PHP Variables
In PHP, a variable is declared using a $ sign followed by the variable name. Here, some important points
to know about variables:
o As PHP is a loosely typed language, so we do not need to declare the data types of the variables. It
automatically analyzes the values and makes conversions to its correct datatype.
o After declaring a variable, it can be reused throughout the code.
o Assignment Operator (=) is used to assign the value to a variable.

Syntax of declaring a variable in PHP is given below:


1. $variablename=value;
Rules for declaring PHP variable:
o A variable must start with a dollar ($) sign, followed by the variable name.
o It can only contain alpha-numeric character and underscore (A-z, 0-9, _).
o A variable name must start with a letter or underscore (_) character.
o A PHP variable name cannot contain spaces.
o One thing to be kept in mind that the variable name cannot start with a number or special symbols.
o PHP variables are case-sensitive, so $name and $NAME both are treated as different variable.

PHP Variable: Declaring string, integer, and float


Let's see the example to store string, integer, and float values in PHP variables.
File: variable1.php

1. <?php
2. $str="hello string";
3. $x=200;
4. $y=44.6;
5. echo "string is: $str <br/>";
6. echo "integer is: $x <br/>";
7. echo "float is: $y <br/>";
8. ?>

Output:
string is: hello string
integer is: 200
float is: 44.6

PHP Constants
PHP constants are name or identifier that can't be changed during the execution of the script except for magic
constants, which are not really constants. PHP constants can be defined by 2 ways:

1. Using define() function


2. Using const keyword
Constants are similar to the variable except once they defined, they can never be undefined or changed. They
remain constant across the entire program. PHP constants follow the same PHP variable rules. For example, it
can be started with a letter or underscore only.

Conventionally, PHP constants should be defined in uppercase letters.


Note: Unlike variables, constants are automatically global throughout the script.

PHP constant: define()


Use the define() function to create a constant. It defines constant at run time. Let's see the syntax of define()
function in PHP.
Play Video

1. define(name, value, case-insensitive)


1. name: It specifies the constant name.
2. value: It specifies the constant value.
3. case-insensitive: Specifies whether a constant is case-insensitive. Default value is false. It means it is case sensitive by
default.

Let's see the example to define PHP constant using define().


File: constant1.php

1. <?php
2. define("MESSAGE","Hello JavaTpoint PHP");
3. echo MESSAGE;
4. ?>

Output:
Hello JavaTpoint PHP

You might also like