The document provides an introduction to PHP including:
- PHP basics like syntax, variables, operators, control structures
- How to work with forms, cookies, files, dates
- Creating functions
- Displaying dates in different formats
- Using arrays
- Server-side scripting alternatives like ASP, Java Servlets
- The goal is to provide enough knowledge to get started with PHP but not teach everything about it.
Unit 5-PHP Declaring variables, data types, array, string, operators, Expres...DRambabu3
Declaring variables, data types, array, string, operators, Expression, control statement, function, Reading data from form controls like text boxes, radio buttons, lists, etc.
Handling file upload. Connecting to the database with CRUD operation (Mysql as reference), Handling sessions and cookies. File handling in PHP.
PHP is a server-side scripting language used for web development that allows developers to create dynamic web pages. Some key points:
- PHP scripts are executed on the server and can contain HTML tags, text, and PHP code.
- PHP can connect to databases like MySQL and supports features like forms, sessions, cookies, and functions.
- Common control structures include if/else statements and while loops. Functions must be defined before use.
- To interact with databases, a connection is made, a database is selected, queries are performed, results are processed, and the connection is closed.
PHP Basics is a presentation that introduces PHP. It discusses that PHP is a server-side scripting language used for building dynamic websites. It can be embedded into HTML. When a PHP file is requested, the server processes the PHP code and returns the output to the browser as HTML. The presentation covers PHP syntax, variables, data types, operators, functions, and conditional statements. It provides examples to illustrate basic PHP concepts and functionality.
The document provides an introduction to PHP basics including:
- PHP code is embedded in HTML using tags and the server executes the PHP code and substitutes output into the HTML page.
- PHP supports variables, data types, operators, control structures like if/else statements and loops. Useful built-in functions allow working with forms, cookies, files, time and date.
- Server-side programming alternatives like CGI, ASP, Java Servlets, and PHP are discussed. PHP was created in 1995 and is now widely used as a free, open-source scripting language for server-side web development.
This document provides an introduction to PHP and MySQL. It begins by stating the goal is to provide basic PHP knowledge and code explanations. It then discusses what PHP is, including that it is an open-source scripting language used to generate dynamic web pages. Several PHP basics are covered, such as variables, functions, includes, forms, and sessions. The document concludes with an overview of PHP, noting its ease of use, large function library, ability to output various file types, and support for many databases. Examples are provided throughout to demonstrate PHP concepts.
This document provides an introduction to PHP and MySQL. It begins by stating the goal is to provide basic PHP knowledge and code explanations. It then discusses what PHP is, including that it is an open-source scripting language used to generate dynamic web pages. Several PHP basics are covered, such as variables, functions, include files, forms, and sessions. The document concludes with an overview of PHP, noting its ease of use, large function library, ability to output different file types, and support for many databases.
This document provides an introduction and overview of PHP and MySQL for beginners. It discusses:
- What PHP is and how it is used to generate dynamic web pages by embedding PHP scripts in HTML.
- Key PHP concepts like variables, data types, echo, comments, functions, and control structures like if/else statements.
- How to connect to and query MySQL databases from PHP scripts using functions like mysql_connect().
- Additional PHP features like forms, sessions, includes and how to avoid common errors when using sessions.
The tutorial is intended to provide just enough PHP and MySQL knowledge to get started developing basic dynamic web applications that interface with databases.
PHP is a server-side scripting language used for web development. It allows developers to add dynamic content and functionality to websites. Some key points about PHP from the document:
- PHP code is embedded into HTML and executed on the server to create dynamic web page content. It can be used to connect to databases, process forms, and more.
- PHP has many data types including strings, integers, floats, booleans, arrays, objects, null values and resources. Variables, operators, and conditional statements allow for control flow and data manipulation.
- Common PHP structures include if/else statements for conditional logic, loops like for/while/foreach for iteration, and functions for reusability. Ar
This document provides an overview of server-side technologies PHP. It begins with an introduction to PHP that describes what PHP is, what PHP files are, and what PHP can do. It then covers PHP features, syntax, variables, operators, conditions and loops, functions, string manipulation, and arrays. The document also includes sample code examples for each topic. It aims to teach the fundamentals of PHP for developing dynamic web applications.
The document provides an agenda for a one day PHP workshop. The agenda includes an introduction to PHP, instructions on how to install PHP, and an example getting started with PHP. Some key topics that will be covered are PHP basics like variables, arrays, loops, and functions. The workshop aims to get participants up and running with PHP from start to finish in a single day.
PHP is an open-source server-side scripting language used for web development. It was created by Rasmus Lerdorf in 1994. Some key points:
- PHP scripts are embedded into HTML pages and executed on the server side, with the output sent to the client. This allows PHP to generate dynamic web page content.
- PHP is free to use and runs on many platforms including Windows, Linux, and Mac. It is compatible with many databases like MySQL.
- The language syntax is loosely based on C and Java. Key constructs include variables, strings, arrays, functions, loops, conditional statements, and object-oriented capabilities.
- PHP files use .php extensions and code
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Muhamad Al Imran
This document provides an introduction to PHP, including an overview of server-side scripting, how PHP code is processed, basic PHP syntax, variables, operators, control structures like conditional statements and loops, and other key PHP concepts. It explains what PHP is, how it is used to create dynamic web content, and some of the basic building blocks needed to get started with PHP programming.
This document provides an introduction to PHP, including an overview of server-side scripting, the basic PHP syntax, variables, operators, control structures like conditional statements and loops, and how PHP code is processed. It explains what PHP is, how it is widely used for building dynamic websites, and the basic components needed to develop PHP applications including a web server, PHP, and a database.
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Muhamad Al Imran
This document provides an introduction to PHP, including an overview of server-side scripting, how PHP code is processed, basic PHP syntax, variables, operators, control structures like conditional statements and loops, and other key PHP concepts. It explains what PHP is, how it is used to create dynamic web content, and some of the basic building blocks needed to get started with PHP programming.
This document provides an introduction to PHP and MySQL for educational purposes. It discusses PHP basics like syntax, variables, operators, control structures, and functions. It also covers server-side dynamic web programming approaches like CGI, ASP, Java Servlets and JSP. The document explains what PHP is, how it works, and what is needed to use it. It provides examples of PHP code for scalars, operators, control structures, arrays and date functions. The goal is to provide basic PHP knowledge and code examples but not teach everything about PHP.
This document provides an introduction to server-side scripting and PHP. It discusses how server-side pages work by having the web server run scripts and send HTML to users' browsers. It then lists several common server-side scripting languages like PHP, ASP, and Python. The document proceeds to introduce PHP in more detail, covering its basics like syntax, variables, strings, arithmetic operators, and functions. It provides examples of conditional statements like if/else and looping with for and while loops.
The document discusses PHP concepts including:
- PHP is a server-side scripting language used for web development and can be used as an alternative to Microsoft ASP.
- XAMPP is an open-source cross-platform web server bundle that can be used to test PHP scripts locally.
- PHP has different data types including strings, integers, floats, booleans, and arrays.
- PHP includes various operators, conditional statements like if/else, and loops like while and foreach to control program flow.
- Functions allow code reusability and modularity in PHP programs. Built-in and user-defined functions are discussed.
- Arrays are a special variable type that can hold multiple values,
This document provides an introduction to PHP, covering topics such as what PHP is, how to set up a PHP development environment, PHP syntax, variables, data types, conditional statements, loops, and arrays. Some key points covered include:
- PHP is a server-side scripting language commonly used for web development. It allows developers to add dynamic content and functionality to websites.
- PHP code is embedded within HTML and executed on the server before the page is sent to the browser.
- The document outlines PHP syntax, how to comment code, and introduces basic programming concepts like variables, data types, conditional statements and loops.
- Arrays allow storing and managing multiple values/elements under one variable
The document provides an introduction to PHP, explaining that it is a server-side scripting language used to generate HTML web pages. It discusses the differences between client-side and server-side scripting, with PHP being an example of server-side scripting. The summary also explains how to create basic PHP pages and covers some basic PHP syntax including variables, data types, operators, and control structures like if/else statements.
PHP is a server-side scripting language commonly used for web development. It allows files containing text, HTML, and PHP scripts to be processed on the server and returned to the browser as plain HTML. PHP can generate dynamic page content, interact with databases, send and receive cookies, and more. Some key features of PHP include that it is free, open source, runs on most server environments, and can be easily learned. The document provides examples of basic PHP syntax, variables, data types, operators, and conditional statements.
This document provides information about PHP (Hypertext Preprocessor), which is a server-side scripting language used for web development. It discusses that PHP scripts are executed on the server, PHP supports many databases, and it is an open source software. The document also explains why PHP is used, where to start with PHP, basic PHP syntax, variables, operators, conditional statements, loops, arrays, functions, forms, connecting to databases, and creating databases and tables. It provides examples of PHP code for many of these concepts to demonstrate how PHP works.
This document provides an overview of course units for a web technologies course. It discusses the following:
Unit I introduces PHP concepts like variables, data types, arrays, strings, operators, control structures, functions, forms, file uploads, database connectivity, sessions and cookies.
Unit II covers XML concepts such as tags, attributes, document type definition, XML schemas, DOM and SAX parsers.
Unit III discusses servlet concepts including the servlet lifecycle, API, packages, request and response handling, cookies, sessions, security and database connectivity using JDBC.
Unit IV focuses on JSP concepts like page anatomy, processing, declarations, directives, expressions, implicit objects, beans, cookies,
This document provides an introduction to PHP and MySQL. It begins by stating the goal is to provide basic PHP knowledge and code explanations. It then discusses what PHP is, including that it is an open-source scripting language used to generate dynamic web pages. Several PHP basics are covered, such as variables, functions, include files, forms, and sessions. The document concludes with an overview of PHP, noting its ease of use, large function library, ability to output different file types, and support for many databases.
This document provides an introduction and overview of PHP and MySQL for beginners. It discusses:
- What PHP is and how it is used to generate dynamic web pages by embedding PHP scripts in HTML.
- Key PHP concepts like variables, data types, echo, comments, functions, and control structures like if/else statements.
- How to connect to and query MySQL databases from PHP scripts using functions like mysql_connect().
- Additional PHP features like forms, sessions, includes and how to avoid common errors when using sessions.
The tutorial is intended to provide just enough PHP and MySQL knowledge to get started developing basic dynamic web applications that interface with databases.
PHP is a server-side scripting language used for web development. It allows developers to add dynamic content and functionality to websites. Some key points about PHP from the document:
- PHP code is embedded into HTML and executed on the server to create dynamic web page content. It can be used to connect to databases, process forms, and more.
- PHP has many data types including strings, integers, floats, booleans, arrays, objects, null values and resources. Variables, operators, and conditional statements allow for control flow and data manipulation.
- Common PHP structures include if/else statements for conditional logic, loops like for/while/foreach for iteration, and functions for reusability. Ar
This document provides an overview of server-side technologies PHP. It begins with an introduction to PHP that describes what PHP is, what PHP files are, and what PHP can do. It then covers PHP features, syntax, variables, operators, conditions and loops, functions, string manipulation, and arrays. The document also includes sample code examples for each topic. It aims to teach the fundamentals of PHP for developing dynamic web applications.
The document provides an agenda for a one day PHP workshop. The agenda includes an introduction to PHP, instructions on how to install PHP, and an example getting started with PHP. Some key topics that will be covered are PHP basics like variables, arrays, loops, and functions. The workshop aims to get participants up and running with PHP from start to finish in a single day.
PHP is an open-source server-side scripting language used for web development. It was created by Rasmus Lerdorf in 1994. Some key points:
- PHP scripts are embedded into HTML pages and executed on the server side, with the output sent to the client. This allows PHP to generate dynamic web page content.
- PHP is free to use and runs on many platforms including Windows, Linux, and Mac. It is compatible with many databases like MySQL.
- The language syntax is loosely based on C and Java. Key constructs include variables, strings, arrays, functions, loops, conditional statements, and object-oriented capabilities.
- PHP files use .php extensions and code
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Muhamad Al Imran
This document provides an introduction to PHP, including an overview of server-side scripting, how PHP code is processed, basic PHP syntax, variables, operators, control structures like conditional statements and loops, and other key PHP concepts. It explains what PHP is, how it is used to create dynamic web content, and some of the basic building blocks needed to get started with PHP programming.
This document provides an introduction to PHP, including an overview of server-side scripting, the basic PHP syntax, variables, operators, control structures like conditional statements and loops, and how PHP code is processed. It explains what PHP is, how it is widely used for building dynamic websites, and the basic components needed to develop PHP applications including a web server, PHP, and a database.
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Muhamad Al Imran
This document provides an introduction to PHP, including an overview of server-side scripting, how PHP code is processed, basic PHP syntax, variables, operators, control structures like conditional statements and loops, and other key PHP concepts. It explains what PHP is, how it is used to create dynamic web content, and some of the basic building blocks needed to get started with PHP programming.
This document provides an introduction to PHP and MySQL for educational purposes. It discusses PHP basics like syntax, variables, operators, control structures, and functions. It also covers server-side dynamic web programming approaches like CGI, ASP, Java Servlets and JSP. The document explains what PHP is, how it works, and what is needed to use it. It provides examples of PHP code for scalars, operators, control structures, arrays and date functions. The goal is to provide basic PHP knowledge and code examples but not teach everything about PHP.
This document provides an introduction to server-side scripting and PHP. It discusses how server-side pages work by having the web server run scripts and send HTML to users' browsers. It then lists several common server-side scripting languages like PHP, ASP, and Python. The document proceeds to introduce PHP in more detail, covering its basics like syntax, variables, strings, arithmetic operators, and functions. It provides examples of conditional statements like if/else and looping with for and while loops.
The document discusses PHP concepts including:
- PHP is a server-side scripting language used for web development and can be used as an alternative to Microsoft ASP.
- XAMPP is an open-source cross-platform web server bundle that can be used to test PHP scripts locally.
- PHP has different data types including strings, integers, floats, booleans, and arrays.
- PHP includes various operators, conditional statements like if/else, and loops like while and foreach to control program flow.
- Functions allow code reusability and modularity in PHP programs. Built-in and user-defined functions are discussed.
- Arrays are a special variable type that can hold multiple values,
This document provides an introduction to PHP, covering topics such as what PHP is, how to set up a PHP development environment, PHP syntax, variables, data types, conditional statements, loops, and arrays. Some key points covered include:
- PHP is a server-side scripting language commonly used for web development. It allows developers to add dynamic content and functionality to websites.
- PHP code is embedded within HTML and executed on the server before the page is sent to the browser.
- The document outlines PHP syntax, how to comment code, and introduces basic programming concepts like variables, data types, conditional statements and loops.
- Arrays allow storing and managing multiple values/elements under one variable
The document provides an introduction to PHP, explaining that it is a server-side scripting language used to generate HTML web pages. It discusses the differences between client-side and server-side scripting, with PHP being an example of server-side scripting. The summary also explains how to create basic PHP pages and covers some basic PHP syntax including variables, data types, operators, and control structures like if/else statements.
PHP is a server-side scripting language commonly used for web development. It allows files containing text, HTML, and PHP scripts to be processed on the server and returned to the browser as plain HTML. PHP can generate dynamic page content, interact with databases, send and receive cookies, and more. Some key features of PHP include that it is free, open source, runs on most server environments, and can be easily learned. The document provides examples of basic PHP syntax, variables, data types, operators, and conditional statements.
This document provides information about PHP (Hypertext Preprocessor), which is a server-side scripting language used for web development. It discusses that PHP scripts are executed on the server, PHP supports many databases, and it is an open source software. The document also explains why PHP is used, where to start with PHP, basic PHP syntax, variables, operators, conditional statements, loops, arrays, functions, forms, connecting to databases, and creating databases and tables. It provides examples of PHP code for many of these concepts to demonstrate how PHP works.
This document provides an overview of course units for a web technologies course. It discusses the following:
Unit I introduces PHP concepts like variables, data types, arrays, strings, operators, control structures, functions, forms, file uploads, database connectivity, sessions and cookies.
Unit II covers XML concepts such as tags, attributes, document type definition, XML schemas, DOM and SAX parsers.
Unit III discusses servlet concepts including the servlet lifecycle, API, packages, request and response handling, cookies, sessions, security and database connectivity using JDBC.
Unit IV focuses on JSP concepts like page anatomy, processing, declarations, directives, expressions, implicit objects, beans, cookies,
A SEW-EURODRIVE brake repair kit is needed for maintenance and repair of specific SEW-EURODRIVE brake models, like the BE series. It includes all necessary parts for preventative maintenance and repairs. This ensures proper brake functionality and extends the lifespan of the brake system
11th International Conference on Data Mining (DaMi 2025)kjim477n
Welcome To DAMI 2025
Submit Your Research Articles...!!!
11th International Conference on Data Mining (DaMi 2025)
July 26 ~ 27, 2025, London, United Kingdom
Submission Deadline : June 07, 2025
Paper Submission : https://csit2025.org/submission/index.php
Contact Us : Here's where you can reach us : [email protected] or [email protected]
For more details visit : Webpage : https://csit2025.org/dami/index
A DECISION SUPPORT SYSTEM FOR ESTIMATING COST OF SOFTWARE PROJECTS USING A HY...ijfcstjournal
One of the major challenges for software, nowadays, is software cost estimation. It refers to estimating the
cost of all activities including software development, design, supervision, maintenance and so on. Accurate
cost-estimation of software projects optimizes the internal and external processes, staff works, efforts and
the overheads to be coordinated with one another. In the management software projects, estimation must
be taken into account so that reduces costs, timing and possible risks to avoid project failure. In this paper,
a decision- support system using a combination of multi-layer artificial neural network and decision tree is
proposed to estimate the cost of software projects. In the model included into the proposed system,
normalizing factors, which is vital in evaluating efforts and costs estimation, is carried out using C4.5
decision tree. Moreover, testing and training factors are done by multi-layer artificial neural network and
the most optimal values are allocated to them. The experimental results and evaluations on Dataset
NASA60 show that the proposed system has less amount of the total average relative error compared with
COCOMO model.
Rearchitecturing a 9-year-old legacy Laravel application.pdfTakumi Amitani
An initiative to re-architect a Laravel legacy application that had been running for 9 years using the following approaches, with the goal of improving the system’s modifiability:
・Event Storming
・Use Case Driven Object Modeling
・Domain Driven Design
・Modular Monolith
・Clean Architecture
This slide was used in PHPxTKY June 2025.
https://phpxtky.connpass.com/event/352685/
Impurities of Water and their Significance.pptxdhanashree78
Impart Taste, Odour, Colour, and Turbidity to water.
Presence of organic matter or industrial wastes or microorganisms (algae) imparts taste and odour to water.
Presence of suspended and colloidal matter imparts turbidity to water.
This study will provide the audience with an understanding of the capabilities of soft tools such as Artificial Neural Networks (ANN), Support Vector Regression (SVR), Model Trees (MT), and Multi-Gene Genetic Programming (MGGP) as a statistical downscaling tool. Many projects are underway around the world to downscale the data from Global Climate Models (GCM). The majority of the statistical tools have a lengthy downscaling pipeline to follow. To improve its accuracy, the GCM data is re-gridded according to the grid points of the observed data, standardized, and, sometimes, bias-removal is required. The current work suggests that future precipitation can be predicted by using precipitation data from the nearest four grid points as input to soft tools and observed precipitation as output. This research aims to estimate precipitation trends in the near future (2021-2050), using 5 GCMs, for Pune, in the state of Maharashtra, India. The findings indicate that each one of the soft tools can model the precipitation with excellent accuracy as compared to the traditional method of Distribution Based Scaling (DBS). The results show that ANN models appear to give the best results, followed by MT, then MGGP, and finally SVR. This work is one of a kind in that it provides insights into the changing monsoon season in Pune. The anticipated average precipitation levels depict a rise of 300–500% in January, along with increases of 200-300% in February and March, and a 100-150% increase for April and December. In contrast, rainfall appears to be decreasing by 20-30% between June and September.
This document provides information about the Fifth edition of the magazine "Sthapatya" published by the Association of Civil Engineers (Practicing) Aurangabad. It includes messages from current and past presidents of ACEP, memories and photos from past ACEP events, information on life time achievement awards given by ACEP, and a technical article on concrete maintenance, repairs and strengthening. The document highlights activities of ACEP and provides a technical educational article for members.
Rigor, ethics, wellbeing and resilience in the ICT doctoral journeyYannis
The doctoral thesis trajectory has been often characterized as a “long and windy road” or a journey to “Ithaka”, suggesting the promises and challenges of this journey of initiation to research. The doctoral candidates need to complete such journey (i) preserving and even enhancing their wellbeing, (ii) overcoming the many challenges through resilience, while keeping (iii) high standards of ethics and (iv) scientific rigor. This talk will provide a personal account of lessons learnt and recommendations from a senior researcher over his 30+ years of doctoral supervision and care for doctoral students. Specific attention will be paid on the special features of the (i) interdisciplinary doctoral research that involves Information and Communications Technologies (ICT) and other scientific traditions, and (ii) the challenges faced in the complex technological and research landscape dominated by Artificial Intelligence.
Third Review PPT that consists of the project d etails like abstract.Sowndarya6
CyberShieldX is an AI-driven cybersecurity SaaS web application designed to provide automated security analysis and proactive threat mitigation for business websites. As cyber threats continue to evolve, traditional security tools like OpenVAS and Nessus require manual configurations and lack real-time automation. CyberShieldX addresses these limitations by integrating AI-powered vulnerability assessment, intrusion detection, and security maintenance services. Users can analyze their websites by simply submitting a URL, after which CyberShieldX conducts an in-depth vulnerability scan using advanced security tools such as OpenVAS, Nessus, and Metasploit. The system then generates a detailed report highlighting security risks, potential exploits, and recommended fixes. Premium users receive continuous security monitoring, automatic patching, and expert assistance to fortify their digital infrastructure against emerging threats. Built on a robust cloud infrastructure using AWS, Docker, and Kubernetes, CyberShieldX ensures scalability, high availability, and efficient security enforcement. Its AI-driven approach enhances detection accuracy, minimizes false positives, and provides real-time security insights. This project will cover the system's architecture, implementation, and its advantages over existing security solutions, demonstrating how CyberShieldX revolutionizes cybersecurity by offering businesses a smarter, automated, and proactive defense mechanism against ever-evolving cyber threats.
2. Goals of the session 1 & 2
Understanding the salient features of PHP
Learning important programming constructs
Comprehending the example codes in PHP
Working out the illustrative programs
individually
3.
PHP == ‘ PHP Hypertext Preprocessor’
Open-source programming script
Server-side scripting language
Executed on the server-side
Used to generate dynamic web-pages
4. Why PHP Is a Great
Programming Language?
Fast Load Time – PHP results in faster site loading speeds
compared ASP .NET
Less Expensive Software - Open source software
Simple & Easy to Grab (similar to C and Java to an extent)
Flexibility & Free ( not restricted to one type of apps, open
source)
Integration (integrating multiple web applications)
Scalability ( enhancing your cluster size by adding servers)
Quality Support ( from global community)
5.
PHP scripts reside between reserved PHP tags
<?PHP ….?>
This allows the programmer to embed PHP
scripts within HTML pages
Interpreted language, scripts are parsed at
run-time rather than compiled beforehand
Various built-in functions allow for fast
development
Compatible with many popular databases
6. What does PHP code look like?
Structurally similar to C/C++
Supports procedural and object-oriented
paradigm (to some degree)
All PHP statements end with a semi-colon
Each PHP script must be enclosed in the
reserved PHP tag
<?php
…
?>
7. Embedding PHP in Web pages
XML Style
<?php echo “Hello , World !”; ?>
SGML style
<? echo “Hello , World !”; ?>
Hello.php
8. RUNNING PHP FILE ON APACHE
By default Apache is using /var/www/html
default directory
Using Linux OS
save it in
/var/www/html/file.php
Using Xamp server in windows OS, save it in
xamp/htdocs/foldername/file.php
Now you can execute the file by running the
browser with
http://localhost/file.php
To check Apache is running on the system
http://localhost/
Apache page will be downloaded
10. Comments in PHP
Standard C, C++, and shell comment
symbols
// C++ and Java-style comment
# Shell-style comments
/* C-style comments
These can span multiple lines */
11. Variables in PHP
PHP variables must begin with a “$” sign
Case-sensitive ($Foo != $foo != $fOo)
Global and locally-scoped variables
Global variables can be used anywhere
Local variables restricted to a function or class
Certain variable names reserved by PHP
Form variables ($_POST, $_GET)
Server variables ($_SERVER)
Etc.
13. Echo
The PHP command ‘echo’ is used to
output the parameters passed to it
The typical usage for this is to send data to the
client’s web-browser
Syntax
void echo (string arg1 [, string argn...])
In practice, arguments are not passed in
parentheses since echo is a language
construct rather than an actual function
14. Echo example
Notice how echo ‘5x5=$foo’ outputs $foo rather than replacing it with 25
Strings in single quotes (‘ ’) are not interpreted or evaluated by PHP
This is true for both variables and character escape-sequences (such as “
n” or “”)
<?php
$foo = 25; // Numerical variable
$bar = “Hello”; // String variable
echo $bar; // Outputs
echo $foo,$bar; // Outputs
echo “5x5=”,$foo; // Outputs
echo “5x5=$foo”; // Outputs
echo ‘5x5=$foo’; // Outputs
?>
15. Arithmetic Operations
$a - $b // subtraction
$a * $b // multiplication
$a / $b // division
$a += 5 // $a = $a+5 Also works for *= and /=
<?php
$a=15;
$b=30;
$total=$a+$b;
Print $total;
Print “<p><h1>$total</h1>”;
// total is 45
?>
16. Concatenation
Use a period to join strings into one.
<?php
$string1=“Hello”;
$string2=“PHP”;
$string3=$string1 . “ ” .
$string2;
Print $string3;
?>
Hello PHP
17. PHP Control Structures
Control Structures: Are the structures within a language
that allow us to control the flow of execution through a
program or script.
Grouped into conditional (branching) structures (e.g.
if/else) and repetition structures (e.g. while loops).
Example if/else if/else statement:
if ($foo == 0) {
echo ‘The variable foo is equal to 0’;
}
else if (($foo > 0) && ($foo <= 5)) {
echo ‘The variable foo is between 1 and 5’;
}
else {
echo ‘The variable foo is equal to ‘.$foo;
}
18. If ... Else...
If (condition)
{
Statements;
}
Else
{
Statement;
}
<?php
If($user==“John”)
{
Print “Hello John.”;
}
Else
{
Print “You are not John.”;
}
?>
No THEN in PHP
20. Switch case
switch($name) {
case ‘rasmus’ :
// do something
break;
case ‘bob’ :
// do something
break;
case ‘bob1’ :
// do something
break;
case ‘bob2’ :
// do something
break;
default :
// do some thing
break;
}
22. Implicit Casting
The conversion of a value from one type to
another is called casting
Type juggling is called implicit casting
Rules for type juggling are
Type of 1st
operand Type of 2nd
operand conversion
Integer Floating int to float
integer String str to integer
float string str to float
23. Type Juggling
• $foo = "0"; // $foo is string (ASCII 48)
• $foo += 2; // $foo is now an integer (2)
• $foo = $foo + 1.3; // $foo is now a float (3.3)
• $foo = 5 + "10 Pieces "; // $foo is integer (15)
$foo = 5 + "Pieces 15";
24. Escaping the Character
If the string has a set of double quotation
marks that must remain visible, use the
[backslash] before the quotation marks to
ignore and display them.
<?php
$heading=“”Computer Science””;
Print $heading;
?>
“Computer Science”
25. Data Types
Integers (-2,147,483,648 to (2,147,483,647)
Floating Point no (3.14, .314E1, 17.0E-3)
Strings can be represented as
‘big dog’ or
“fat cat”
Variables are expanded within double quotes while within
single quotes they are not
$name=“Ram”
Echo ‘hi,$name’
o/p : hi,$name
echo “hi,$name”
o/p : hi,Ram (Demo: function.php)