SlideShare a Scribd company logo
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
Hidaya Institute of
Science &
Technology
www.histpk.org
A Division of Hidaya Trust, Pakistan
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
String Functions and Operations
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
What Is String?
A string is a data type used in programming, such as an integer and floating point
unit, but is used to represent text rather than numbers. It is comprised of a set of
characters that can also contain spaces and numbers. For example, the word
"hamburger" and the phrase "I ate 3 hamburgers" are both strings. Even "12345"
could be considered a string, if specified correctly. Typically, programmers must
enclose strings in quotation marks for the data to recognized as a string and not a
number or variable name.
โ€ขString is a collection of characters.
โ€ขString is a collection of ASCII characters.
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
PHP chr() Function
The chr() function returns a character from the specified ASCII value.
Syntax
chr(ascii)
Example
<?php
echo chr(65);
echo chr(122);
?>
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
PHP ord() Function
The ord() function returns the ASCII value of the first character of a string.
Syntax
ord(string)
Example
<?php
echo ord(โ€œhโ€).โ€<br />โ€;
echo ord(โ€œhelloโ€).โ€<br />โ€;
?>
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
PHP strlen() Function
The strlen() function is used to return the length of a string.
Syntax
strlen(string)
Example
<?php
echo strlen("Hello world!");
?>
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
PHP substr() Function
The substr() function returns a part of a string.
Syntax
substr(string,start,length)
Example
<?php
echo substr("Hello world!",6);
echo substr("Hello world!",6,5);
?>
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
PHP trim() Function
The trim() function removes whitespaces from both sides of a string.
Syntax
trim(string)
Example
<?php
echo trim(โ€œ Hello World โ€);
?>
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
Assignment # 1
Enter String
Text
Click
Output
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
Assignment # 2 Enter String
Text
Click
Output
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
Assignment # 3
Enter String Text
Click
Output
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
Assignment # 4
Enter some
text here
Find
character
Replace
character
Click
Output
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
Assignment # 5
Enter Text
Click
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
Assignment # 5
Output
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
Assignment # 6
Characte
r
Output
Click
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
Assignment # 6
Characte
r
Output
Click
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
Assignment # 7
Enter Text
Click
Output
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
PHP rand() Function
The rand() function generates a random integer.
If this function is called without parameters, it returns a random integer
between 0 and RAND_MAX.
If you want a random number between 10 and 100 (inclusive), use rand
(10,100).
Note: On some platforms (such as Windows) RAND_MAX is only 32768. So,
if you require a range larger than 32768, you can specify min and max, or
use the mt_rand() function instead.
The other random function, mt_rand() function generates a better random
value than this function .
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
โ€ข PHP rand() Function continueโ€ฆโ€ฆ
โ€ข Syntax
rand(min,max)
Example 1
<?php
echo(rand() . "<br />");
echo(getrandmax(). "<br />");
echo(rand(10,100));
?>
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
โ€ข PHP rand() Function continueโ€ฆโ€ฆ
โ€ข Example 2
<?php
echo "<hr> mt_rand = ".mt_rand()."<hr>";
echo "<hr>rand = ".rand()."<hr>";
echo "<hr> mt_rand with range = ".mt_rand(1,100)."<hr>";
echo "<hr> rand with range = ".rand(1,100)."<hr>";
?>
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
โ€ข PHP round() function
โ€ข The round() function rounds a number to the
nearest integer.
โ€ข Syntax:
โ€ข round(x,prec)
Parameter Description
x Required. The number to be round
prec Optional. The number of digits after the decimal point
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
โ€ข PHP round() function continuedโ€ฆ.
โ€ข Example 1
โ€ข <?php
โ€ข echo round(1.68) ;
โ€ข ?>
โ€ข Example 2
โ€ข <?php
โ€ข echo round(1.68,1) ;
โ€ข ?>
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
โ€ข PHP ceil() function
โ€ข The ceil() function returns the value of a number rounded
UPWARDS to the nearest integer.
Syntax
Ceil(x)
Example:
<?php
echo ceil(0.60);
?>
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
โ€ข PHP floor() Function
โ€ข The floor() function returns the value of a number rounded
DOWNWARDS to the nearest integer.
Syntax
floor(x)
Example:
<?php
echo floor(0.60);
?>
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
PHP explode() Function
The explode() function breaks a string into an array.
Syntax
explode(separator,string)
Example
<?php
$string = "Hello world. It's a beautiful day.";
print_r (explode(" ",$string));
?>
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
PHP implode() Function
The implode() function returns a string from the elements of an array.
Syntax
implode(separator,array)
Example
<?php
$array = array('Hello','World!','Beautiful','Day!');
echo implode(" ",$array);
?>
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
Assignment # 8
Disabled Textbox Click Generate
Password
Output
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
Assignment # 9
Enter
Word
Click
Output
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
Assignment # 10 Enter
Text
Click
Output
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
โ€ข PHP ucfirst() Function
โ€ข The ucfirst() function converts the first character of a string to
uppercase.
โ€ข Syntax
ucfirst(string)
โ€ข Example
<?php
echo ucfirst("hello world");
?>
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
โ€ข PHP ucwords() Function
โ€ข The ucwords() function converts the first character of each word in a
string to uppercase
โ€ข Syntax:
โ€ข ucwords(string)
โ€ข Example:
<?php
echo ucwords("hello world");
?>
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
โ€ข PHP strtolower() Function
โ€ข The strtolower() function converts a string to lowercase.
โ€ข Syntax:
strtolower(string)
Example:
<?php
echo strtolower("Hello WORLD.");
?>
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
โ€ข PHP strtoupper() Function
โ€ข The strtoupper() function converts a string to lowercase.
โ€ข Syntax:
strtoupper(string)
Example:
<?php
echo strtoupper(โ€œhello world.");
?>
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
Assignment # 11 Enter Text
Encrypt Text
Encrypted Data Decrypt
Text
Output
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
PHP hash_algos() Function
hash_algos โ€” Return a list of registered hashing algorithms
Syntax
array hash_algos ()
Example
<?php
print_r(hash_algos());
?>
ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org
PHP md5() Function
The md5() function calculates the MD5 hash of a string.
This function returns the calculated MD5 hash on success, or FALSE on
failure.
Syntax
md5(string)
Example
<?php
$string = "Hello";
echo md5($string);
?>

More Related Content

What's hot

C++ string
C++ stringC++ string
C++ string
Dheenadayalan18
ย 
Java Tokens
Java  TokensJava  Tokens
Java Tokens
Madishetty Prathibha
ย 
Applets
AppletsApplets
Applets
Prabhakaran V M
ย 
Java I/O
Java I/OJava I/O
Java I/O
Jussi Pohjolainen
ย 
Java string handling
Java string handlingJava string handling
Java string handling
Salman Khan
ย 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVA
VINOTH R
ย 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
Priya Goyal
ย 
Strings in Java
Strings in JavaStrings in Java
Strings in Java
Abhilash Nair
ย 
Php string function
Php string function Php string function
Php string function
Ravi Bhadauria
ย 
Wrapper class
Wrapper classWrapper class
Wrapper class
kamal kotecha
ย 
Strings in python
Strings in pythonStrings in python
Strings in python
Prabhakaran V M
ย 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
Abhilash Nair
ย 
Javascript event handler
Javascript event handlerJavascript event handler
Javascript event handler
Jesus Obenita Jr.
ย 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
Taha Malampatti
ย 
Presentation on-exception-handling
Presentation on-exception-handlingPresentation on-exception-handling
Presentation on-exception-handling
Nahian Ahmed
ย 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT
03062679929
ย 
Php array
Php arrayPhp array
Php array
Nikul Shah
ย 
ASP.NET Page Life Cycle
ASP.NET Page Life CycleASP.NET Page Life Cycle
ASP.NET Page Life Cycle
Abhishek Sur
ย 
URL Class in JAVA
URL Class in JAVAURL Class in JAVA
URL Class in JAVA
Ramasubbu .P
ย 
JavaScript - Chapter 4 - Types and Statements
 JavaScript - Chapter 4 - Types and Statements JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and Statements
WebStackAcademy
ย 

What's hot (20)

C++ string
C++ stringC++ string
C++ string
ย 
Java Tokens
Java  TokensJava  Tokens
Java Tokens
ย 
Applets
AppletsApplets
Applets
ย 
Java I/O
Java I/OJava I/O
Java I/O
ย 
Java string handling
Java string handlingJava string handling
Java string handling
ย 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVA
ย 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
ย 
Strings in Java
Strings in JavaStrings in Java
Strings in Java
ย 
Php string function
Php string function Php string function
Php string function
ย 
Wrapper class
Wrapper classWrapper class
Wrapper class
ย 
Strings in python
Strings in pythonStrings in python
Strings in python
ย 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
ย 
Javascript event handler
Javascript event handlerJavascript event handler
Javascript event handler
ย 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
ย 
Presentation on-exception-handling
Presentation on-exception-handlingPresentation on-exception-handling
Presentation on-exception-handling
ย 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT
ย 
Php array
Php arrayPhp array
Php array
ย 
ASP.NET Page Life Cycle
ASP.NET Page Life CycleASP.NET Page Life Cycle
ASP.NET Page Life Cycle
ย 
URL Class in JAVA
URL Class in JAVAURL Class in JAVA
URL Class in JAVA
ย 
JavaScript - Chapter 4 - Types and Statements
 JavaScript - Chapter 4 - Types and Statements JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and Statements
ย 

Viewers also liked

String functions
String functionsString functions
String functions
Kumar Krishnan
ย 
String operation
String operationString operation
String operation
Shakila Mahjabin
ย 
C string
C stringC string
Strings in C
Strings in CStrings in C
Strings in C
Kamal Acharya
ย 
C programming - String
C programming - StringC programming - String
C programming - String
Achyut Devkota
ย 
String
StringString
String
Kishan Gohel
ย 
Algorithm Designs - Control Structures
Algorithm Designs - Control StructuresAlgorithm Designs - Control Structures
Algorithm Designs - Control Structures
hatredai
ย 

Viewers also liked (7)

String functions
String functionsString functions
String functions
ย 
String operation
String operationString operation
String operation
ย 
C string
C stringC string
C string
ย 
Strings in C
Strings in CStrings in C
Strings in C
ย 
C programming - String
C programming - StringC programming - String
C programming - String
ย 
String
StringString
String
ย 
Algorithm Designs - Control Structures
Algorithm Designs - Control StructuresAlgorithm Designs - Control Structures
Algorithm Designs - Control Structures
ย 

Similar to String functions and operations

String functions and operations
String functions and operations String functions and operations
String functions and operations
Mudasir Syed
ย 
String functions and operations
String functions and operations String functions and operations
String functions and operations
Mudasir Syed
ย 
Functions in php
Functions in phpFunctions in php
Functions in php
Mudasir Syed
ย 
Javascript lecture 4
Javascript lecture  4Javascript lecture  4
Javascript lecture 4
Mudasir Syed
ย 
Reporting using FPDF
Reporting using FPDFReporting using FPDF
Reporting using FPDF
Mudasir Syed
ย 
Java script lecture 1
Java script lecture 1Java script lecture 1
Java script lecture 1
Mudasir Syed
ย 
Javascript 2
Javascript 2Javascript 2
Javascript 2
Mudasir Syed
ย 
Introduction To PHP
Introduction To PHPIntroduction To PHP
Introduction To PHP
Shweta A
ย 
PHP 5.4 New Features
PHP 5.4 New FeaturesPHP 5.4 New Features
PHP 5.4 New Features
Haim Michael
ย 
Php tutorialw3schools
Php tutorialw3schoolsPhp tutorialw3schools
Php tutorialw3schools
rasool noorpour
ย 
Php tutorial(w3schools)
Php tutorial(w3schools)Php tutorial(w3schools)
Php tutorial(w3schools)
Arjun Shanka
ย 
PHP BASIC PRESENTATION
PHP BASIC PRESENTATIONPHP BASIC PRESENTATION
PHP BASIC PRESENTATION
krutitrivedi
ย 
TWINS: OOP and FP - Warburton
TWINS: OOP and FP - WarburtonTWINS: OOP and FP - Warburton
TWINS: OOP and FP - Warburton
Codemotion
ย 
PHP complete reference with database concepts for beginners
PHP complete reference with database concepts for beginnersPHP complete reference with database concepts for beginners
PHP complete reference with database concepts for beginners
Mohammed Mushtaq Ahmed
ย 
"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson
GWTcon
ย 
Wt unit 4 server side technology-2
Wt unit 4 server side technology-2Wt unit 4 server side technology-2
Wt unit 4 server side technology-2
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
ย 
Introduction to PHP (SDPHP)
Introduction to PHP   (SDPHP)Introduction to PHP   (SDPHP)
Introduction to PHP (SDPHP)
Eric Johnson
ย 
Python and the MySQL Document Store
Python and the MySQL Document StorePython and the MySQL Document Store
Python and the MySQL Document Store
Jesper Wisborg Krogh
ย 
Php reports sumit
Php reports sumitPhp reports sumit
Php reports sumit
Sumit Biswas
ย 
More about PHP
More about PHPMore about PHP
More about PHP
Jonathan Francis Roscoe
ย 

Similar to String functions and operations (20)

String functions and operations
String functions and operations String functions and operations
String functions and operations
ย 
String functions and operations
String functions and operations String functions and operations
String functions and operations
ย 
Functions in php
Functions in phpFunctions in php
Functions in php
ย 
Javascript lecture 4
Javascript lecture  4Javascript lecture  4
Javascript lecture 4
ย 
Reporting using FPDF
Reporting using FPDFReporting using FPDF
Reporting using FPDF
ย 
Java script lecture 1
Java script lecture 1Java script lecture 1
Java script lecture 1
ย 
Javascript 2
Javascript 2Javascript 2
Javascript 2
ย 
Introduction To PHP
Introduction To PHPIntroduction To PHP
Introduction To PHP
ย 
PHP 5.4 New Features
PHP 5.4 New FeaturesPHP 5.4 New Features
PHP 5.4 New Features
ย 
Php tutorialw3schools
Php tutorialw3schoolsPhp tutorialw3schools
Php tutorialw3schools
ย 
Php tutorial(w3schools)
Php tutorial(w3schools)Php tutorial(w3schools)
Php tutorial(w3schools)
ย 
PHP BASIC PRESENTATION
PHP BASIC PRESENTATIONPHP BASIC PRESENTATION
PHP BASIC PRESENTATION
ย 
TWINS: OOP and FP - Warburton
TWINS: OOP and FP - WarburtonTWINS: OOP and FP - Warburton
TWINS: OOP and FP - Warburton
ย 
PHP complete reference with database concepts for beginners
PHP complete reference with database concepts for beginnersPHP complete reference with database concepts for beginners
PHP complete reference with database concepts for beginners
ย 
"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson
ย 
Wt unit 4 server side technology-2
Wt unit 4 server side technology-2Wt unit 4 server side technology-2
Wt unit 4 server side technology-2
ย 
Introduction to PHP (SDPHP)
Introduction to PHP   (SDPHP)Introduction to PHP   (SDPHP)
Introduction to PHP (SDPHP)
ย 
Python and the MySQL Document Store
Python and the MySQL Document StorePython and the MySQL Document Store
Python and the MySQL Document Store
ย 
Php reports sumit
Php reports sumitPhp reports sumit
Php reports sumit
ย 
More about PHP
More about PHPMore about PHP
More about PHP
ย 

More from Mudasir Syed

Error reporting in php
Error reporting in php Error reporting in php
Error reporting in php
Mudasir Syed
ย 
Cookies in php lecture 2
Cookies in php  lecture  2Cookies in php  lecture  2
Cookies in php lecture 2
Mudasir Syed
ย 
Cookies in php lecture 1
Cookies in php lecture 1Cookies in php lecture 1
Cookies in php lecture 1
Mudasir Syed
ย 
Ajax
Ajax Ajax
Ajax
Mudasir Syed
ย 
Oop in php lecture 2
Oop in  php lecture 2Oop in  php lecture 2
Oop in php lecture 2
Mudasir Syed
ย 
Oop in php lecture 2
Oop in  php lecture 2Oop in  php lecture 2
Oop in php lecture 2
Mudasir Syed
ย 
Filing system in PHP
Filing system in PHPFiling system in PHP
Filing system in PHP
Mudasir Syed
ย 
Time manipulation lecture 2
Time manipulation lecture 2Time manipulation lecture 2
Time manipulation lecture 2
Mudasir Syed
ย 
Time manipulation lecture 1
Time manipulation lecture 1 Time manipulation lecture 1
Time manipulation lecture 1
Mudasir Syed
ย 
Php Mysql
Php Mysql Php Mysql
Php Mysql
Mudasir Syed
ย 
Adminstrating Through PHPMyAdmin
Adminstrating Through PHPMyAdminAdminstrating Through PHPMyAdmin
Adminstrating Through PHPMyAdmin
Mudasir Syed
ย 
Sql select
Sql select Sql select
Sql select
Mudasir Syed
ย 
PHP mysql Sql
PHP mysql  SqlPHP mysql  Sql
PHP mysql Sql
Mudasir Syed
ย 
PHP mysql Mysql joins
PHP mysql  Mysql joinsPHP mysql  Mysql joins
PHP mysql Mysql joins
Mudasir Syed
ย 
PHP mysql Introduction database
 PHP mysql  Introduction database PHP mysql  Introduction database
PHP mysql Introduction database
Mudasir Syed
ย 
PHP mysql Installing my sql 5.1
PHP mysql  Installing my sql 5.1PHP mysql  Installing my sql 5.1
PHP mysql Installing my sql 5.1
Mudasir Syed
ย 
PHP mysql Er diagram
PHP mysql  Er diagramPHP mysql  Er diagram
PHP mysql Er diagram
Mudasir Syed
ย 
PHP mysql Database normalizatin
PHP mysql  Database normalizatinPHP mysql  Database normalizatin
PHP mysql Database normalizatin
Mudasir Syed
ย 
PHP mysql Aggregate functions
PHP mysql Aggregate functionsPHP mysql Aggregate functions
PHP mysql Aggregate functions
Mudasir Syed
ย 
Form validation with built in functions
Form validation with built in functions Form validation with built in functions
Form validation with built in functions
Mudasir Syed
ย 

More from Mudasir Syed (20)

Error reporting in php
Error reporting in php Error reporting in php
Error reporting in php
ย 
Cookies in php lecture 2
Cookies in php  lecture  2Cookies in php  lecture  2
Cookies in php lecture 2
ย 
Cookies in php lecture 1
Cookies in php lecture 1Cookies in php lecture 1
Cookies in php lecture 1
ย 
Ajax
Ajax Ajax
Ajax
ย 
Oop in php lecture 2
Oop in  php lecture 2Oop in  php lecture 2
Oop in php lecture 2
ย 
Oop in php lecture 2
Oop in  php lecture 2Oop in  php lecture 2
Oop in php lecture 2
ย 
Filing system in PHP
Filing system in PHPFiling system in PHP
Filing system in PHP
ย 
Time manipulation lecture 2
Time manipulation lecture 2Time manipulation lecture 2
Time manipulation lecture 2
ย 
Time manipulation lecture 1
Time manipulation lecture 1 Time manipulation lecture 1
Time manipulation lecture 1
ย 
Php Mysql
Php Mysql Php Mysql
Php Mysql
ย 
Adminstrating Through PHPMyAdmin
Adminstrating Through PHPMyAdminAdminstrating Through PHPMyAdmin
Adminstrating Through PHPMyAdmin
ย 
Sql select
Sql select Sql select
Sql select
ย 
PHP mysql Sql
PHP mysql  SqlPHP mysql  Sql
PHP mysql Sql
ย 
PHP mysql Mysql joins
PHP mysql  Mysql joinsPHP mysql  Mysql joins
PHP mysql Mysql joins
ย 
PHP mysql Introduction database
 PHP mysql  Introduction database PHP mysql  Introduction database
PHP mysql Introduction database
ย 
PHP mysql Installing my sql 5.1
PHP mysql  Installing my sql 5.1PHP mysql  Installing my sql 5.1
PHP mysql Installing my sql 5.1
ย 
PHP mysql Er diagram
PHP mysql  Er diagramPHP mysql  Er diagram
PHP mysql Er diagram
ย 
PHP mysql Database normalizatin
PHP mysql  Database normalizatinPHP mysql  Database normalizatin
PHP mysql Database normalizatin
ย 
PHP mysql Aggregate functions
PHP mysql Aggregate functionsPHP mysql Aggregate functions
PHP mysql Aggregate functions
ย 
Form validation with built in functions
Form validation with built in functions Form validation with built in functions
Form validation with built in functions
ย 

Recently uploaded

Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
ย 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
nitinpv4ai
ย 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
ย 
Bร€I TแบฌP Bแป” TRแปข TIแบพNG ANH LแปšP 9 Cแบข Nฤ‚M - GLOBAL SUCCESS - Nฤ‚M HแปŒC 2024-2025 - ...
Bร€I TแบฌP Bแป” TRแปข TIแบพNG ANH LแปšP 9 Cแบข Nฤ‚M - GLOBAL SUCCESS - Nฤ‚M HแปŒC 2024-2025 - ...Bร€I TแบฌP Bแป” TRแปข TIแบพNG ANH LแปšP 9 Cแบข Nฤ‚M - GLOBAL SUCCESS - Nฤ‚M HแปŒC 2024-2025 - ...
Bร€I TแบฌP Bแป” TRแปข TIแบพNG ANH LแปšP 9 Cแบข Nฤ‚M - GLOBAL SUCCESS - Nฤ‚M HแปŒC 2024-2025 - ...
Nguyen Thanh Tu Collection
ย 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
PsychoTech Services
ย 
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
ย 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
Celine George
ย 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
ย 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
National Information Standards Organization (NISO)
ย 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
ย 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
Iris Thiele Isip-Tan
ย 
skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)
Mohammad Al-Dhahabi
ย 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Henry Hollis
ย 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
ย 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
nitinpv4ai
ย 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
RamseyBerglund
ย 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
RidwanHassanYusuf
ย 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
JomonJoseph58
ย 
Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
National Information Standards Organization (NISO)
ย 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
ย 

Recently uploaded (20)

Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
ย 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
ย 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
ย 
Bร€I TแบฌP Bแป” TRแปข TIแบพNG ANH LแปšP 9 Cแบข Nฤ‚M - GLOBAL SUCCESS - Nฤ‚M HแปŒC 2024-2025 - ...
Bร€I TแบฌP Bแป” TRแปข TIแบพNG ANH LแปšP 9 Cแบข Nฤ‚M - GLOBAL SUCCESS - Nฤ‚M HแปŒC 2024-2025 - ...Bร€I TแบฌP Bแป” TRแปข TIแบพNG ANH LแปšP 9 Cแบข Nฤ‚M - GLOBAL SUCCESS - Nฤ‚M HแปŒC 2024-2025 - ...
Bร€I TแบฌP Bแป” TRแปข TIแบพNG ANH LแปšP 9 Cแบข Nฤ‚M - GLOBAL SUCCESS - Nฤ‚M HแปŒC 2024-2025 - ...
ย 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
ย 
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
ย 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
ย 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
ย 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
ย 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
ย 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
ย 
skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)
ย 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
ย 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
ย 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
ย 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
ย 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
ย 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
ย 
Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
ย 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
ย 

String functions and operations

  • 1. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org Hidaya Institute of Science & Technology www.histpk.org A Division of Hidaya Trust, Pakistan
  • 2. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org String Functions and Operations
  • 3. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org What Is String? A string is a data type used in programming, such as an integer and floating point unit, but is used to represent text rather than numbers. It is comprised of a set of characters that can also contain spaces and numbers. For example, the word "hamburger" and the phrase "I ate 3 hamburgers" are both strings. Even "12345" could be considered a string, if specified correctly. Typically, programmers must enclose strings in quotation marks for the data to recognized as a string and not a number or variable name. โ€ขString is a collection of characters. โ€ขString is a collection of ASCII characters.
  • 4. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org PHP chr() Function The chr() function returns a character from the specified ASCII value. Syntax chr(ascii) Example <?php echo chr(65); echo chr(122); ?>
  • 5. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org PHP ord() Function The ord() function returns the ASCII value of the first character of a string. Syntax ord(string) Example <?php echo ord(โ€œhโ€).โ€<br />โ€; echo ord(โ€œhelloโ€).โ€<br />โ€; ?>
  • 6. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org PHP strlen() Function The strlen() function is used to return the length of a string. Syntax strlen(string) Example <?php echo strlen("Hello world!"); ?>
  • 7. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org PHP substr() Function The substr() function returns a part of a string. Syntax substr(string,start,length) Example <?php echo substr("Hello world!",6); echo substr("Hello world!",6,5); ?>
  • 8. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org PHP trim() Function The trim() function removes whitespaces from both sides of a string. Syntax trim(string) Example <?php echo trim(โ€œ Hello World โ€); ?>
  • 9. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org Assignment # 1 Enter String Text Click Output
  • 10. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org Assignment # 2 Enter String Text Click Output
  • 11. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org Assignment # 3 Enter String Text Click Output
  • 12. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org Assignment # 4 Enter some text here Find character Replace character Click Output
  • 13. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org Assignment # 5 Enter Text Click
  • 14. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org Assignment # 5 Output
  • 15. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org Assignment # 6 Characte r Output Click
  • 16. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org Assignment # 6 Characte r Output Click
  • 17. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org Assignment # 7 Enter Text Click Output
  • 18. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org PHP rand() Function The rand() function generates a random integer. If this function is called without parameters, it returns a random integer between 0 and RAND_MAX. If you want a random number between 10 and 100 (inclusive), use rand (10,100). Note: On some platforms (such as Windows) RAND_MAX is only 32768. So, if you require a range larger than 32768, you can specify min and max, or use the mt_rand() function instead. The other random function, mt_rand() function generates a better random value than this function .
  • 19. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org โ€ข PHP rand() Function continueโ€ฆโ€ฆ โ€ข Syntax rand(min,max) Example 1 <?php echo(rand() . "<br />"); echo(getrandmax(). "<br />"); echo(rand(10,100)); ?>
  • 20. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org โ€ข PHP rand() Function continueโ€ฆโ€ฆ โ€ข Example 2 <?php echo "<hr> mt_rand = ".mt_rand()."<hr>"; echo "<hr>rand = ".rand()."<hr>"; echo "<hr> mt_rand with range = ".mt_rand(1,100)."<hr>"; echo "<hr> rand with range = ".rand(1,100)."<hr>"; ?>
  • 21. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org โ€ข PHP round() function โ€ข The round() function rounds a number to the nearest integer. โ€ข Syntax: โ€ข round(x,prec) Parameter Description x Required. The number to be round prec Optional. The number of digits after the decimal point
  • 22. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org โ€ข PHP round() function continuedโ€ฆ. โ€ข Example 1 โ€ข <?php โ€ข echo round(1.68) ; โ€ข ?> โ€ข Example 2 โ€ข <?php โ€ข echo round(1.68,1) ; โ€ข ?>
  • 23. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org โ€ข PHP ceil() function โ€ข The ceil() function returns the value of a number rounded UPWARDS to the nearest integer. Syntax Ceil(x) Example: <?php echo ceil(0.60); ?>
  • 24. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org โ€ข PHP floor() Function โ€ข The floor() function returns the value of a number rounded DOWNWARDS to the nearest integer. Syntax floor(x) Example: <?php echo floor(0.60); ?>
  • 25. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org PHP explode() Function The explode() function breaks a string into an array. Syntax explode(separator,string) Example <?php $string = "Hello world. It's a beautiful day."; print_r (explode(" ",$string)); ?>
  • 26. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org PHP implode() Function The implode() function returns a string from the elements of an array. Syntax implode(separator,array) Example <?php $array = array('Hello','World!','Beautiful','Day!'); echo implode(" ",$array); ?>
  • 27. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org Assignment # 8 Disabled Textbox Click Generate Password Output
  • 28. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org Assignment # 9 Enter Word Click Output
  • 29. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org Assignment # 10 Enter Text Click Output
  • 30. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org โ€ข PHP ucfirst() Function โ€ข The ucfirst() function converts the first character of a string to uppercase. โ€ข Syntax ucfirst(string) โ€ข Example <?php echo ucfirst("hello world"); ?>
  • 31. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org โ€ข PHP ucwords() Function โ€ข The ucwords() function converts the first character of each word in a string to uppercase โ€ข Syntax: โ€ข ucwords(string) โ€ข Example: <?php echo ucwords("hello world"); ?>
  • 32. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org โ€ข PHP strtolower() Function โ€ข The strtolower() function converts a string to lowercase. โ€ข Syntax: strtolower(string) Example: <?php echo strtolower("Hello WORLD."); ?>
  • 33. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org โ€ข PHP strtoupper() Function โ€ข The strtoupper() function converts a string to lowercase. โ€ข Syntax: strtoupper(string) Example: <?php echo strtoupper(โ€œhello world."); ?>
  • 34. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org Assignment # 11 Enter Text Encrypt Text Encrypted Data Decrypt Text Output
  • 35. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org PHP hash_algos() Function hash_algos โ€” Return a list of registered hashing algorithms Syntax array hash_algos () Example <?php print_r(hash_algos()); ?>
  • 36. ยฉ Copyright 2012 Hidaya Trust (Pakistan) โ— A Non-Profit Organization โ— www.hidayatrust.org / www,histpk.org PHP md5() Function The md5() function calculates the MD5 hash of a string. This function returns the calculated MD5 hash on success, or FALSE on failure. Syntax md5(string) Example <?php $string = "Hello"; echo md5($string); ?>