Blog Post RSS ?

Blogs » PHP » ASP to PHP
 

ASP to PHP

by Lucas Chan

Hi, my name is Lucas Chan. I’m also a resident coder at SitePoint HQ and I’ll be popping my head in here from time to time to help out with the PHP blog.

Over the past week or so I’ve been assisting a friend of mine redevelop one of his ASP sites in PHP (with MySQL). He knows ASP quite well but has never touched PHP before.

Having had bad experiences with language conversion tools I was reluctant to recommend one to him. I instead pointed him to the PHP manual and the wonderful archive of information at SitePoint.com. Harry also mentioned a syntax cross reference some time last year.

I thought it would be interesting to document some of the help I’ve given him over the past few weeks. Here’s some of what we discussed:

Use ‘%’ instead of ‘mod’ to find the remainder of a division:
$remainder = 5 % 4;

Incrementing a number is easy using the ++ expression.

Use the explode() function to split a string by a string.

No, I don’t know who is responsible for naming the PHP functions. :)

Yes, the following will give you unexpected results:
$i = $i++;

Checking if your record set has any results in it is easy using the mysql_num_rows() function (add a database abstraction layer to taste).

The field types in MySQL are a little different. Use TINYINT or for your boolean fields, and use DECIMAL to store your monetary values.

The list goes on.

All in all it seems he came away from his crash course in PHP with only a few scratches. Have you had any success converting your ASP site to PHP?

What good resources did you find?

Did you have any luck with any of the ASP to PHP converters?

What are some of the issues you had trouble resolving?

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Ping.fm
  • Twitthis

Related posts:

  1. How to Use PHP Namespaces, Part 3: Keywords and Autoloading In the final part of his series explaining PHP namespaces,...
  2. Build a Buzzword Bingo Card in PHP Bored in meetings? Worry no longer. Raena demonstrates how to...
  3. Ready for PHP & MySQL Week at SitePoint? To celebrate the release of the new edition of well-loved...
  4. How to Use PHP Namespaces, Part 1: The Basics In the first part of a series of articles, Craig...
  5. Free PHP Webinar: How to Increase Performance with Caching Zend are running a free webinar today, with a live...

This post has 27 responses so far

Sponsored Links

SitePoint Marketplace

Buy and sell Websites, templates, domain names, hosting, graphics and more.

Follow SitePoint on...