SlideShare ist ein Scribd-Unternehmen logo
1 von 26
Downloaden Sie, um offline zu lesen
PHP Function

projectsoft.biz
ก
PHP MySQL Ajax(jquery)

Web Application F
PHP Function
F function
function( F F ก F F )
{
…….. ;
…….. ;
return F F ก F ก ;
}

projectsoft.biz
ก
PHP MySQL Ajax(jquery)

Web Application F
PHP Function
<?php
echo hello();
function hello()
{
return "hello";
}
?>

projectsoft.biz
ก
PHP MySQL Ajax(jquery)

Web Application F
PHP Function
<?php
echo showNum(1);
function showNum($n)
{
if($n=="1")
{return 1;}
else if($n=="2")
{return 2;}
}
?>
projectsoft.biz
ก
Web Application F
PHP MySQL Ajax(jquery)
PHP Function
showStart(3);
function showStart($n){
$count1=1;
while($count1<=$n){$count2=1;
while($count2<=$count1)
{echo "*";$count2++;}
echo "<br />";
$count1++;}
}
projectsoft.biz
ก
PHP MySQL Ajax(jquery)

Web Application F
PHP Sub String Function
substr(string,start position,length );
F
<?php
$str="abc";
echo substr($str,1,1);
?>
F F b

projectsoft.biz
ก
PHP MySQL Ajax(jquery)

Web Application F
PHP Sub String Function
<?php
$str="abc";
echo substr($str,1);
?>
F

F
F

bc
F

ก F F F
F

projectsoft.biz
ก
PHP MySQL Ajax(jquery)

ˈ F

F
string
F
F

Web Application F

string
F ก

F ก
string
F

F
PHP Sub String Date
<?php
echo showDate("2010-10-18");
function showDate($date)
{
$day=substr($date,8,2);
$month=substr($date,5,2);
$year=substr($date,0,4);
return $day."/".$month."/".$year;
}
?>
projectsoft.biz
ก
PHP MySQL Ajax(jquery)

Web Application F
PHP String Replace
<?php
$str="hello WORLD";
echo str_replace("hello","HELLO",$str);
?>
F F HELLO WORLD
ก
F
F F string
ก
F ก F ก
F
string
F
string F

projectsoft.biz
ก
PHP MySQL Ajax(jquery)

Web Application F

string
PHP String Replace
<?php
$str="anbncn";
echo str_replace("n","<br />",$str);
?>

projectsoft.biz
ก
PHP MySQL Ajax(jquery)

Web Application F
PHP String Length
Function strlen() F
<?php
echo strlen("php");
?>
F F ˈ
php

projectsoft.biz
ก
PHP MySQL Ajax(jquery)

Web Application F

ก

ก

F 3

string F

ก
PHP String Length
<?php
$str="12345";
if(strlen($str)>6){echo "greater than 6 ";}
else{echo “less than 6”;}
?>

projectsoft.biz
ก
PHP MySQL Ajax(jquery)

Web Application F
PHP String Position
strpos($string, "find string")
Function strpos F
F
F F
string
$string
string
ก
find string
ก
F ก
<?php
$str="@bc";
echo strpos($str,"@");
?> ก
F
ก
0
ก
F 0
projectsoft.biz
ก
PHP MySQL Ajax(jquery)

Web Application F

F

ก
F ก

F

F
F

F

Fก

F
F

F
PHP String Position
ก
F
F ก F
function strpos return false
<?php
$mystring = 'bc';
$findme = 'a';
$pos = strpos($mystring, $findme);
if ($pos === false) {
echo "The string ”.$findme.“ was not found in the string”;
}
?>

projectsoft.biz
ก
PHP MySQL Ajax(jquery)

Web Application F
F ก

ก

file

<?php
$file_name="my_picture.jpg";
$type = substr($file_name, strpos($file_name,"."));
echo $type;
?>
F
ก
.jpg

projectsoft.biz
ก
PHP MySQL Ajax(jquery)

Web Application F
ก

string

ก

string ก
ก
function strtolower()
<?php
$str1="HeLLoWoRLd";
$str2=strtolower($str1);
echo $str2;
?>

projectsoft.biz
ก
PHP MySQL Ajax(jquery)

Web Application F

ก

F ˈ
F ˈ

F ก
F ก F F
ก

string

ก

string ก
ก
function strtoupper()
<?php
$str1=“heLLoWoRld";
$str2= strtoupper($str1);
echo $str2;
?>

projectsoft.biz
ก
PHP MySQL Ajax(jquery)

Web Application F

ก

F ˈ
F ˈ

F

F F
F F F
F function date()
ʾ

ก F ก
ˆ
function date() F
• date("d/m/Y")
• ก F ก
F
ˆ
• date("H:i:s")

projectsoft.biz
ก
PHP MySQL Ajax(jquery)

/ ʾ

/

•

ˆ

Web Application F

ˈ

:

F

:

F
ʾ
•
•
•
•
•
•
•
•

F function date()

function date()
F ก
F
ˈ
d
m
Y
ʾ ..
ก
y
ʾ ..
ก
H
ˈ
i
s
projectsoft.biz
ก
PHP MySQL Ajax(jquery)

F parameter
ʾ

Web Application F

ˈ sting

F
ก

F

<?php
$strDate1="2012-01-01";//
F
$strDate2="2012-02-1";//
echo DateDiff($strDate1,$strDate2);
// ก function DateDiff
F

F

F

// F function DateDiff
F
F $strDate1
$strDate2
function DateDiff($strDate1,$strDate2)
{
//
ˈ
F
// F
F 86400 ( 1
86400
)
F
return (strtotime($strDate2) - strtotime($strDate1))/ ( 60 * 60 * 24 );
}
?> projectsoft.biz
PHP MySQL Ajax(jquery)

ก

Web Application F
ก

/F

<?php
//ก
echo date('Y-m-d', strtotime(' +1 day'));//

n

php
F

echo date('Y-m-d', strtotime('+60 day', strtotime("2012-5-2")));
//
ก
2 2554 60
//ก
กF
F
echo date('Y-m-d', strtotime(' -1 day'));//

echo date('Y-m-d', strtotime('-60 day', strtotime( "2012-1-31" )));
//
F
ก
1 2554 60
?>
projectsoft.biz
ก
PHP MySQL Ajax(jquery)

Web Application F
PHP Include

projectsoft.biz
ก
PHP MySQL Ajax(jquery)

Web Application F
PHP include
include(“
F.php”);
include(“
.php”);
F
ก
F
include
F F
F include1_1.php
<?php echo "Hello ";?>
<?php
include("include1_1.php");
echo " World";
?>
F F Hello World
projectsoft.biz
ก
PHP MySQL Ajax(jquery)

Web Application F

F
PHP include
F

F include1_1.php F folder include

F

ก

<?php
include("include/include1_1.php");
echo " World";
?>
F
F

F
F

projectsoft.biz
ก
PHP MySQL Ajax(jquery)

ˈ Hello World
F ก F

Web Application F

F

F
F

F ก include
PHP include + Function
F showDate.php
F function F
<?php
function showDate($date)
{
$day=substr($date,8,2);
$month=substr($date,5,2);
$year=substr($date,0,4);
return $day."/".$month."/".$year;
}
?>
projectsoft.biz
ก
PHP MySQL Ajax(jquery)

Web Application F
PHP + Include
<?php
include("function/showDate.php");
$date=showDate("2010-10-01");
echo $date;
?>
F

include

projectsoft.biz
ก
PHP MySQL Ajax(jquery)

function showDate F

Web Application F

Weitere ähnliche Inhalte

Was ist angesagt?

PHP an intro -1
PHP an intro -1PHP an intro -1
PHP an intro -1
Kanchilug
 
PerlでWeb API入門
PerlでWeb API入門PerlでWeb API入門
PerlでWeb API入門
Yusuke Wada
 

Was ist angesagt? (19)

Get into the FLOW with Extbase
Get into the FLOW with ExtbaseGet into the FLOW with Extbase
Get into the FLOW with Extbase
 
Perl6 grammars
Perl6 grammarsPerl6 grammars
Perl6 grammars
 
Mojolicious
MojoliciousMojolicious
Mojolicious
 
PHP an intro -1
PHP an intro -1PHP an intro -1
PHP an intro -1
 
Refactoring using Codeception
Refactoring using CodeceptionRefactoring using Codeception
Refactoring using Codeception
 
Melhorando sua API com DSLs
Melhorando sua API com DSLsMelhorando sua API com DSLs
Melhorando sua API com DSLs
 
Neo Technology
Neo TechnologyNeo Technology
Neo Technology
 
PerlでWeb API入門
PerlでWeb API入門PerlでWeb API入門
PerlでWeb API入門
 
Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2
 
Perl5i
Perl5iPerl5i
Perl5i
 
TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...
TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...
TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...
 
ZCPE - PHP Conference 2015
ZCPE   - PHP Conference 2015ZCPE   - PHP Conference 2015
ZCPE - PHP Conference 2015
 
PHP7 - Scalar Type Hints & Return Types
PHP7 - Scalar Type Hints & Return TypesPHP7 - Scalar Type Hints & Return Types
PHP7 - Scalar Type Hints & Return Types
 
Php with my sql
Php with my sqlPhp with my sql
Php with my sql
 
Introducation to php for beginners
Introducation to php for beginners Introducation to php for beginners
Introducation to php for beginners
 
Using Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkUsing Geeklog as a Web Application Framework
Using Geeklog as a Web Application Framework
 
RESTful web services
RESTful web servicesRESTful web services
RESTful web services
 
PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)
PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)
PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)
 
DEV Čtvrtkon #76 - Fluent Interface
DEV Čtvrtkon #76 - Fluent InterfaceDEV Čtvrtkon #76 - Fluent Interface
DEV Čtvrtkon #76 - Fluent Interface
 

Ähnlich wie Session3

Avinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPressAvinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPress
wpnepal
 
international PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secretsinternational PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secrets
smueller_sandsmedia
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5a
rajivmordani
 
OSDC.TW - Gutscript for PHP haters
OSDC.TW - Gutscript for PHP hatersOSDC.TW - Gutscript for PHP haters
OSDC.TW - Gutscript for PHP haters
Lin Yo-An
 
GettingStartedWithPHP
GettingStartedWithPHPGettingStartedWithPHP
GettingStartedWithPHP
Nat Weerawan
 
Javascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJSJavascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJS
Ladislav Prskavec
 
After max+phonegap
After max+phonegapAfter max+phonegap
After max+phonegap
yangdj
 

Ähnlich wie Session3 (20)

symfony & jQuery (phpDay)
symfony & jQuery (phpDay)symfony & jQuery (phpDay)
symfony & jQuery (phpDay)
 
Avinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPressAvinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPress
 
WordPress Realtime - WordCamp São Paulo 2015
WordPress Realtime - WordCamp São Paulo 2015WordPress Realtime - WordCamp São Paulo 2015
WordPress Realtime - WordCamp São Paulo 2015
 
Ditching JQuery
Ditching JQueryDitching JQuery
Ditching JQuery
 
J query training
J query trainingJ query training
J query training
 
Make WordPress realtime.
Make WordPress realtime.Make WordPress realtime.
Make WordPress realtime.
 
Hooks WCSD12
Hooks WCSD12Hooks WCSD12
Hooks WCSD12
 
symfony & jQuery (PUG)
symfony & jQuery (PUG)symfony & jQuery (PUG)
symfony & jQuery (PUG)
 
The Beauty of Java Script
The Beauty of Java ScriptThe Beauty of Java Script
The Beauty of Java Script
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
international PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secretsinternational PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secrets
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5a
 
OSDC.TW - Gutscript for PHP haters
OSDC.TW - Gutscript for PHP hatersOSDC.TW - Gutscript for PHP haters
OSDC.TW - Gutscript for PHP haters
 
Phing101 or How to staff a build orchestra
Phing101 or How to staff a build orchestraPhing101 or How to staff a build orchestra
Phing101 or How to staff a build orchestra
 
PHPCon 2016: PHP7 by Witek Adamus / XSolve
PHPCon 2016: PHP7 by Witek Adamus / XSolvePHPCon 2016: PHP7 by Witek Adamus / XSolve
PHPCon 2016: PHP7 by Witek Adamus / XSolve
 
GettingStartedWithPHP
GettingStartedWithPHPGettingStartedWithPHP
GettingStartedWithPHP
 
jQuery secrets
jQuery secretsjQuery secrets
jQuery secrets
 
Php web backdoor obfuscation
Php web backdoor obfuscationPhp web backdoor obfuscation
Php web backdoor obfuscation
 
Javascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJSJavascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJS
 
After max+phonegap
After max+phonegapAfter max+phonegap
After max+phonegap
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Session3