PHP Basics
This document provides an overview of PHP basics including comments, constants, data types, variables, output functions, superglobals, here documents, operators, and references. It discusses the syntax and usage of PHP comments, defines constants, lists the main data types, explains how to declare variables, compares print and echo output functions, outlines common superglobal variables, demonstrates here documents, and covers unary, arithmetic, assignment, comparison, logical, and ternary operators as well as references.
It contains different concepts of Object Oriented PHP like cloning of object, Inheritance, function overriding, Final function, Error Handling, Exception Handling, Custom error handling class, Uploading a file to the server with different criteria like file size, file type, file extension etc. are discussed in this presentation.
Kindly look at it and give comments to improve it as good as possible ways.
It contains different concepts of Object Oriented PHP like cloning of object, Inheritance, function overriding, Final function, Error Handling, Exception Handling, Custom error handling class, Uploading a file to the server with different criteria like file size, file type, file extension etc. are discussed in this presentation.
Kindly look at it and give comments to improve it as good as possible ways.
PHP is one of the simplest server-side languages out there, and it was designed primarily for web development. Learning PHP is good not only because it adds ...
It contains basic fundamental of class, object, method overloading, constructor, destructor, visibility, acess specifier, Methods, overloading, clonning of objects etc. are covered here.
Kindly look at it and give your comments to improve it as good as possible ways.
In this presentation you are going to learn about basics of Web and php mysql web development. we discover about What is world wide web? How client server works? Why PHP is important? and basics of PHP like installation, variables, operators, conditional statements and loops.
Php my sql - functions - arrays - tutorial - programmerblog.netProgrammer Blog
In this ppt you will learn about functions and array in php. What are functions, how to declare and use. built in functions. include and required keywords. how are arguments used. how to create functions inside functions.
What are php arrays, how to create an array and use them. Built in array functions. What are super globals?
PHP is one of the simplest server-side languages out there, and it was designed primarily for web development. Learning PHP is good not only because it adds ...
It contains basic fundamental of class, object, method overloading, constructor, destructor, visibility, acess specifier, Methods, overloading, clonning of objects etc. are covered here.
Kindly look at it and give your comments to improve it as good as possible ways.
In this presentation you are going to learn about basics of Web and php mysql web development. we discover about What is world wide web? How client server works? Why PHP is important? and basics of PHP like installation, variables, operators, conditional statements and loops.
Php my sql - functions - arrays - tutorial - programmerblog.netProgrammer Blog
In this ppt you will learn about functions and array in php. What are functions, how to declare and use. built in functions. include and required keywords. how are arguments used. how to create functions inside functions.
What are php arrays, how to create an array and use them. Built in array functions. What are super globals?
Myassignmenthelpers.com is an Online service provider for Php assignments & homework problems. Our online experts provide Php Assignment help & Php homework help with aims to help college students across the globe. Our writers provide you unique data along with a plagiarised report so that you can ensure that your data is unique. Our writers are available 24*7. Please send your complete requirements at support@myassignmenthelpers.com or else attach on the website. You can also discuss the requirements with our chat agent.
Ethnobotany and Ethnopharmacology:
Ethnobotany in herbal drug evaluation,
Impact of Ethnobotany in traditional medicine,
New development in herbals,
Bio-prospecting tools for drug discovery,
Role of Ethnopharmacology in drug evaluation,
Reverse Pharmacology.
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
Andreas Schleicher presents at the OECD webinar ‘Digital devices in schools: detrimental distraction or secret to success?’ on 27 May 2024. The presentation was based on findings from PISA 2022 results and the webinar helped launch the PISA in Focus ‘Managing screen time: How to protect and equip students against distraction’ https://www.oecd-ilibrary.org/education/managing-screen-time_7c225af4-en and the OECD Education Policy Perspective ‘Students, digital devices and success’ can be found here - https://oe.cd/il/5yV
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
1. WEB PROGRAMMING
PHP Basics
S.Muthuganesh M.Sc.,B.Ed
Assistant Professor
Department of Computer Science
Vivekananda College
Tiruvedakam West
ganesh01muthu@gmail.com
2. Comments
• Giving the name of the program, the author and other details, which the
programmer would like to use.
• Its not executed part and its only for one who looking at the code.
Syntax
// This is the first programme (Single line Comments //)
# Declaring Variable (Single line Comments #)
/*this is block comment
Placed over two or more
Lines*/ (Multiple line comments /*………*/)
3. Constants
• A constant is an identifier (name) for a simple value. As the name suggests, that
value cannot change during the execution of the script. A constant is case-
sensitive by default should follow the variables rules to define a constant. There
is no need $(dollar symbol).
Syntax
define(“<constantname>”,<expr> [,<casesensitive>]);
Example
define(“stringcons”,”hai welcome”);
define(“intcons”,2000);
define(“pi”,3.14);
4. Data types
• PHP has several types, all holds specific class of information.
String
Strings are sequences of characters that are always internally NULL terminated.
There is no limit to size Ex $str=”hai how are you?”;
Integer
It holds whole numbers, it can be specified in decimal (base 10), hexadecimal (base
16 - prefixed with 0x) or octal (base 8 - prefixed with 0) notation, optionally
preceded by a sign (- or +). There is a maximum limit from -2147483647(-231) to
+2147483647(+231).
Float
Floating point numbers that holds high integer values or fractional numbers
Ex $pi=3.14;
5. Data types
Boolean
Booleans are like a switch it has only two possible values either 1 (true) or 0 (false).
Arrays
An array is a variable that can hold more than one value at a time. It is useful to
aggregate a series of related items together.
Ex $weekdays=(“Sunday”,”Monday”,”Tuesday”);
Objects
Object variable are complex variables that holds own properties and methods for
accessing or manipulating their content.
Resource
A resource is a special variable that hold anything that is not PHP data. Resource
variables typically hold special handlers to opened files and database connections.
6. Variables
• All variables in PHP start with a $ sign, followed by the name of the variable.
• A variable name must start with a letter or the underscore character
• A variable name cannot start with a number
• A variable name can only contain alpha-numeric characters and underscores (A-z,
0-9, and _ )
• Variable names are case-sensitive ($name and $NAME are two different
variables)
Declaring variable
$var_name=value;
Ex
$age=19;
$name=“karthick”;
$amount=45.89;
7. Deliver text as output
• To output text in a PHP script to a browser print or echo is command which tells the
PHP interpreter what do.
Print
Print is also a statement i.e used to display the output. it can be used with
parentheses print( ) or without parentheses print.
using print can doesn't pass multiple argument
it’s slower
ex print(“hai”);
echo
echo is a statement i.e used to display the output. it can be used with parentheses
echo or without parentheses echo.
echo can pass multiple string separated as ( , )
its faster than print
ex echo(“hai”);
8. Superglobals
• Superglobals are variables do not have a fixed scope they are available in all of
them, they provide as follows
• Useful information about the environment
• Allow to access to HTML form variables or parenthesis
• Access to cookies stored on a client
• Keeping tracking session and file uploads
• $_GET : $_GET is a super global variable used to collect data from the HTML form
after submitting it. $_GET super global array variable stores the values that come
in the URL.
• $_POST: superglobal is needed in order to pass PHP variables or collect data from
forms after they have been submitted via an HTML form. It’s similar to $_GET,
conventionally used the contents of an HTML form are going to change values in
database permanently.
9. Superglobals
• $_REQUEST: It is a superglobal variable which is used to collect the data after
submitting a HTML form. It's similar to $_GET and $_POST variables. $_REQUEST
is not used mostly, because $_POST and $_GET perform the same task and are
widely used.
• $GLOBALS : It is a superglobal variable which is used to access global variables
from anywhere in the PHP script. PHP stores all the global variables in array
$GLOBALS where index holds the global variable name.
• $_COOKIE – contains all variables passed to HTTP Cookies.
• $_SERVER: set by the web server or otherwise directly related to current
environment the script.
10. Superglobals
• $_SESSION – holds the variables which are currently registered script.
• $_ENV - An associative of variables passed to the current script via the
environment method.
• $_FILES – holds variables are uploaded to the current script via the HTTP POST
method.
11. Here Documents
• Here documents a special form of I/O
redirection to feed command list to an
interactive program or command.
• you need to set in your PHP script a string
containing big chunk of text data (for
example, HTML code), it is easier to use
"here document" style.
• This special way allows you to set multiline
strings, with all included variables
expanded as it is done in double quotes
style.
• Save as
C:xampphtdocsprogramsheredoc.php
• Start Apache server
• Run in any Browser
http://localhost/programs/heredoc.php
<?php
$heremes=<<<EOF
<b>list of books</b>
<ol>
<li>java
<li>Programming in C
<li>OOP with C++
<li>PHP and HTML
</ol>
EOF;
echo($heremes);
?>
12. Operators
• Operators is any symbol used to perform an operation on a value. PHP operator
classified into
• Unary operator
• Binary operator
• Ternary operator
Unary operator
It works on only one operand
Operator Meaning Description
! Logical Negation True if the operand evaluates to false
False if the operand evaluates to true
~ Bitwise negation Bitwise representation
13. Unary operator – increment and decrement
• Increment ++ increases the value by 1 whereas decrement -- decreases the value
by 1.
• ++ operator as prefix like: ++$var. The value of var is incremented by 1 then, it
returns the value.
• use ++ operator as postfix like: $var++. The original value of var is returned first
then, var is incremented by 1.
• -- operator as prefix like: --$var. The value of var is decremented by 1 then, it
returns the value.
• use -- operator as postfix like: $var--. The original value of var is returned first
then, var is decremented by 1.
14. Cast operator
• Way to force a type conversion of value using the cast operators. The operand
appear on the right side of the cast operator and its result is converted type.
$val=3.14;
$valint=(int)$val;
It returns 3
Operator Changes type to
int or integer Integer
float, real or double Floating point
string String
bool or boolean Boolean
array Array
object object
15. Arithmetic Operator
• Here are following arithmetic operators supported by PHP language −Assume
variable A holds 10 and variable B holds 5 then −
Operator Description Example
+ Adds two operands $A + $B will give 15
- Subtracts second operand from the first $A - $B will give 5
* Multiply both operands $A * $B will give 50
/ Divide numerator by de-numerator $A / $B will give 2
% Modulus Operator and remainder of after an integer division $A % $B will give 0
++ Increment operator, increases integer value by one $A++ will give 11
-- Decrement operator, decreases integer value by one $A-- will give 9
16. Assignment operator
• The assignment operators are used to assign values result of an expression to a variable Assigns
values from right side operands to left side operand
Opera
tor
Description Example
= Simple assignment operator. $C = $A + $B will assign the value of $A + $B to $C
+= Add AND assignment operator. $C+= $A is equivalent to $C = $C + $A
-= Subtract AND assignment operator. $C -= $A is equivalent to $C = $C - $A
*= Multiply AND assignment operator. $C *= $A is equivalent to $C = $C * $A
/= Divide AND assignment operator. $C /= $A is equivalent to $C = $C / $A
%= Modulus AND assignment operator. $C %= $A is equivalent to $C = $C % $A
17. Comparison operator
• We often compare two quantities and depending on their relation, take certain
decisions
Operator Description
== 3==9 returns false
!= 3!=9 returns true.
> 3>9 returns false
< 3<9 returns true
>= Checks if the value of left operand is greater than or equal to the value of right operand. If yes, then the condition
becomes true. 15>=18 returns false
<= Checks if the value of left operand is less than or equal to the value of right operand. If yes, then the condition
becomes true. 15<=18 returns true
=== Identical that means 3===3 returns true
18. Concatenates
• The concatenation operator (‘.‘), which returns the concatenation of its right and
left arguments (join two arguments).
<?php
$a=10;
$b=20;
$c=$a+$b;
echo ”the addition of value of c=“.$c;
?>
OUTPUT
the addition of c=30
19. Logical operator
• The logical operators are used when we want, test more than one condition
Operator Description
&&, and Called Logical AND operator. If both the operands are non-zero, then the condition becomes true.
||,or,|| Called Logical OR Operator. If any of the two operands is non-zero, then the condition becomes true.
! Called Logical NOT Operator. It is used to reverse the logical state of its operand. If a condition is true, then
Logical NOT operator will make it false.
20. Bitwise operator
• The Bitwise operators is used to perform Bit-level operations on the operands.
The operators are first converted to bit-level (Binary Digit) and then calculation is
performed on the operands.
Operator Meaning
Bitwise AND & This is a binary operator. Bitwise AND operator in PHP takes two numbers as operands and does AND
on every bit of two numbers. The result of AND is 1 only if both bits are 1.
Bitwise OR | This is also binary operator. Bitwise OR operator takes two numbers as operands and does OR on every
bit of two numbers. The result of OR is 1 any of the two bits is 1.
Bitwise XOR ^ This is also binary operator. Bitwise XOR takes two numbers as operands and does XOR on every bit of
two numbers. The result of XOR is 1 if the two bits are different.
Numbers/
Bit level
23=8 22=4 21=2 20=1 Result
4 0 1 0 0
5 0 1 0 1
Bitwise AND & 0 1 0 0 4
Bitwise OR | 0 1 0 1 5
Bitwise OR ^ 0 0 0 1 1
21. Ternary Operator (Conditional Operator)
• In simple words, PHP Ternary Operator is a shortened method of writing an if-
else statement.
Syntax
$condition ? 'true result' : 'false result';
Example
<?php
$n=11;
$ans=($n%2==0)?"even number":"odd number";
echo $ans;
?>
Output
odd number
22. Reference Operator
• When the = operator is used, PHP performs a copy operation.
• References allow two variables to refer to the same content.
• The ampersand (&) is placed before the variable to be referenced.
• Once two variables are pointing to the same data, either of variables can be
changed and the other one will also be updated.