Anda di halaman 1dari 13

Introduction to

SpringPeople Software Private Limited, All Rights Reserved.

What is php?
PHP is an acronym for "PHP: Hypertext
Preprocessor"
PHP is a widely-used, open source scripting
language.
PHP scripts are executed on the server.
PHP is free to download and use.

SpringPeople Software Private Limited, All Rights Reserved.

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, modify data in your database
PHP can be used to control user-access
PHP can encrypt data
With PHP you are not limited to output HTML. You can output
images, PDF files, and even Flash movies. You can also output
any text, such as XHTML and XML.
SpringPeople Software Private Limited, All Rights Reserved.

How to create a php page?


1. Install Wamp (Windows-Apache-Mysql-PHP)
2. Create a new folder within Wamp\WWW folder with the
name you want to give your project
Eg: C:\Wamp\WWW\myProject
3. Right click and Create a new text file with extension .php
Eg: index.php

SpringPeople Software Private Limited, All Rights Reserved.

Data types in php


PHP data types are divided in two categories:
Scalar
boolean :A value that can only either be true or false
Int :A signed numeric integer value
float : A signed floating-point value
string : A collection of binary data
Composite
Arrays
Objects

SpringPeople Software Private Limited, All Rights Reserved.

Type Casting
echo ((0.1 + 0.7) * 10);
echo (int) ((0.1 + 0.7) * 10);

//Outputs 8
//Outputs 7

This happens because the result of this simple


arithmetic expression is stored internally as 7.999999
instead of 8; when the value is converted to int, PHP
simply truncates away the fractional part, resulting in
a rather significant error (12.5%, to be exact).

SpringPeople Software Private Limited, All Rights Reserved.

Variables
Variables are temporary storage containers.
In PHP, a variable can contain any type of data, such
as, for example, strings, integers, floating numbers,
objects and arrays.
PHP is loosely typed, meaning that it will implicitly
change the type of a variable as needed, depending
on the operation being performed on its value.
This contrasts with strongly typed languages, like C
and Java, where variables can only contain one type
of data throughout their existence.
SpringPeople Software Private Limited, All Rights Reserved.

PHP Sending Mails


PHP must be configured correctly in the php.ini file
with the details of how your system sends email.
Open php.ini file available in /etc/ directory and find
the section headed [mail function].
Windows users should ensure that two directives are
supplied. The first is called SMTP that defines your
email server address. The second is called
sendmail_from which defines your own email
address.

SpringPeople Software Private Limited, All Rights Reserved.

PHP Sending Mails (cont.)


Sending plain text email:
PHP makes use of mail() function to send an email. This
function requires three mandatory arguments that specify the
recipient's email address, the subject of the the message and
the actual message additionally there are other two optional
parameters.
mail( to, subject, message, headers, parameters ); Here
is the description for each parameters.

SpringPeople Software Private Limited, All Rights Reserved.

PHP Sending Mails (cont.)


<html>
<head>
<title>Sending email using PHP</title>
</head>
<body>
<?php
$to = "xyz@somedomain.com";
$subject = "This is subject";
$message = "This is simple text message.";
$header = "From:abc@somedomain.com \r\n";
$retval = mail ($to,$subject,$message,$header);
if( $retval == true )
{
echo "Message sent successfully...";
}
Else
{
echo "Message could not be sent...";
}
?>
</body>
</html>

SpringPeople Software Private Limited, All Rights Reserved.

How you can master PHP?


Become an expert in 3 days.
World class PHP corporate training by the industry
experts.

More Details

SpringPeople Software Private Limited, All Rights Reserved.

Suggested Audience & Other Details


Suggested Audience - Programmers and Developers who
would like to gain the knowledge in developing dynamic web
pages.
Duration - 3 Days
Prerequisites - All participants must be fluent in HTML. The
course can be customized to any level of programming and
relational database familiarity.
Syllabus

SpringPeople Software Private Limited, All Rights Reserved.

For further info/assistance contact


training@springpeople.com
+91 80 656 79700
www.springpeople.com

Our Partners

SpringPeople Software Private Limited, All Rights Reserved.

Anda mungkin juga menyukai