Log In

  Sign In >
 
 

Other tips & tutorials Blogs

Comparing PHP to ASP - Week 4 - Looping

2 Jun 2010
tips-tutorials

Looping is an important part of any development language. For this tutorial we will look at some ...

 
 

Comparing PHP to ASP - Week 3 - Number Functions

24 May 2010
tips-tutorials

Welcome to the third part of our 5 part tutorial where we will compare PHP with Classic ASP

 
 

Comparing PHP to ASP - Week 1 - The Basics

10 May 2010
tips-tutorials

Welcome to the first part of our 5 part tutorial where we will compare PHP with Classic ASP

 
 

Week 5 - JQuery and AJAX

26 Mar 2010
tips-tutorials

This week I will show you probably the main benefit of learning JQuery. AJAX (Asynchronous ...

 
 

Week 4 - Changing CSS attributes

19 Mar 2010
tips-tutorials

This week I will show you how to add CSS styles to elements on a page of your website.

 
 

Categories

Archive

2010
2 3 4 5 6 7 8 9 10 11 12

 

 

Comparing PHP to ASP - Week 2 - String Functions

18 May 2010 - tips-tutorials

Comparing PHP to ASP - Week 2 - String Functions

Welcome to the second part of our 5 part tutorial where we will compare PHP with Classic ASP.

The objective of these tutorials is to show you how to do some basic programming in PHP and compare it to how you would do it in Classic ASP using VB Script.

This five part tutorial will be split into five sections:

  • Part 1 - The Basics
  • Part 2 - String Functions
  • Part 3 - Number Functions
  • Part 4 - Looping
  • Part 5 - Sessions and Cookies

String Length in PHP

String Length in Classic ASP

Both of these examples would output the value 11.

Make a String Uppercase in PHP

Make a String Uppercase in Classic ASP

Both of these examples would output the value HELLO WORLD.

Make a String Lowercase in PHP

Make a String Lowercase in Classic ASP

Both of these examples would output the value hello world.

Return Part of a String in PHP

The function we will be using for this is substr(string,start,length)

The substr() function take three parameters:
string - the string used to return part of
start - the start position to return part of
length - the number of characters to return after the start position

Return Part of a String in Classic ASP

The function we will be using for this is mid(string,start,length)

The mid() function take three parameters:
string - the string used to return part of
start - the start position to return part of
length - the number of characters to return after the start position

Each of these examples would output the first 5 characters in the string 'hello world'. So only 'hello' will be returned to the browser.

Replace Part of a String in PHP

The objective for the next example will be to replace 'hello' with 'goodbye' in the string 'hello world', therefore outputing 'goodbye world'.

The function we will be using for this is str_replace(find,replace,string)

The str_replace() function take three parameters:
find - the word you want to replace
replace - what you want to replace it with
string - the string used to replace part of

Replace Part of a String in Classic ASP

The function we will be using for this is Replace(string,find,replacewith)

The Replace() function take three parameters:
string - the string used to replace part of
find - the word you want to replace
replacewith - what you want to replace it with

Each of these examples will output 'goodbye world'.

I hope you have enjoyed part 2 of our 5 part tutorial. Look out for part 3 on number functions coming soon.

Simon Lait
Website Developer, Candeo Media

SHARE THIS

Your Comments

There are no comments for this post yet.

Comment on this Post

 
 
 
verification image

Please enter the verification code that appears in the box above into the box below to proceed:

 
 
 
 
 
 
Web Design & Development, Graphic Design, Email Newsletter Marketing, Search Engine Optimisation, Web Application Development, Social Networking and more...
 
 
Close

Sign up to our newsletter