PHP: PHP and other languages - Manual
PHP  
downloads | documentation | faq | getting help | mailing lists | | php.net sites | links 
search for in the  
previousPHP and COMMigrating from PHP 2 to PHP 3next
Last updated: Fri, 30 Aug 2002
view the printer friendly version or the printer friendly version with notes or change language to English | Brazilian Portuguese | Chinese | Czech | Dutch | Finnish | French | German | Italian | Japanese | Korean | Polish | Romanian | Russian | Spanish | Swedish | Turkish

Fejezet 55. PHP and other languages

PHP is the best language for web programing, but what about other languages?

1. PHP vs. ASP?
2. Is there an ASP to PHP converter?
3. PHP vs. Cold Fusion?
4. PHP vs. Perl?

1. PHP vs. ASP?

ASP is not really a language in itself, it's an acronym for Active Server Pages, the actual language used to program ASP with is Visual Basic Script or JScript. The biggest drawback of ASP is that it's a proprietary system that is natively used only on Microsoft Internet Information Server (IIS). This limits it's availability to Win32 based servers. There are a couple of projects in the works that allows ASP to run in other environments and webservers: from (commercial), from (commercial) and (free). ASP is said to be a slower and more cumbersome language than PHP, less stable as well. Some of the pros of ASP is that since it primarily uses VBScript it's relatively easy to pick up the language if you're already know how to program in Visual Basic. ASP support is also enabled by default in the IIS server making it easy to get up and running. The components built in ASP are really limited, so if you need to use "advanced" features like interacting with FTP servers, you need to buy additional components.

2. Is there an ASP to PHP converter?

Yes, is the one most often referred to.

3. PHP vs. Cold Fusion?

PHP is commonly said to be faster and more efficient for complex programming tasks and trying out new ideas. PHP is generally referred to as more stable and less resource intensive as well. Cold Fusion has better error handling, database abstraction and date parsing although database abstraction is addressed in PHP 4. Another thing that is listed as one of Cold Fusion's strengths is its excellent search engine, but it has been mentioned that a search engine is not something that should be included in a web scripting language. PHP runs on almost every platform there is; Cold Fusion is only available on Win32, Solaris, Linux and HP/UX. Cold Fusion has a good IDE and is generally easier to get started with, whereas PHP initially requires more programming knowledge. Cold Fusion is designed with non-programmers in mind, while PHP is focused on programmers.

A great summary by Michael J Sheldon on this topic has been posted to the PHP mailing list. A copy can be found .

4. PHP vs. Perl?

The biggest advantage of PHP over Perl is that PHP was designed for scripting for the web where Perl was designed to do a lot more and can because of this get very complicated. The flexibility / complexity of Perl makes it easier to write code that another author / coder has a hard time reading. PHP has a less confusing and stricter format without losing flexibility. PHP is easier to integrate into existing HTML than Perl. PHP has pretty much all the 'good' functionality of Perl: constructs, syntax and so on, without making it as complicated as Perl can be. Perl is a very tried and true language, it's been around since the late eighties, but PHP is maturing very quickly.

User Contributed Notes
PHP and other languages
add a note about notes
[email protected]
29-Jul-2001 10:44

ASP rely on a scripting engine which out-of-the-box support VBScript and JScript (MS version of JavaScript). Support for other languages (ie Perl) is available throught add-on modules.
[email protected]
29-Aug-2001 09:45

Actually, ASP isn't as terrible as one might think, if you have a background in Javascript (or other object-based languages with dot-notation (object.object.function()). VBScript is a pain, true (cuz it looks, feels, and smells of VB), but JScript is a lot nicer and syntactically looks like Javascript with extra functions added for server-side stuff (ie., file i/o) that Javascript can't do client-side.

And while most of the code samples on the net and documentation talks about VBScript, JScript docs and manuals can be found on M$'s sites in a few places.

Where VBScript has that painful

IF ...
ENDIF

crap, JScript has the friendly

if () {
// ...
}

and even

for (indexVar in ArrayName) {
// ...
}

stuff, very much like PHP's foreach() looping.

Once you get around the bulky object syntax for opening, closing, writing, appending files/folders, it's not too bad. Good regExp handling, too. And translating from PHP to ASP and back again is a good programmatic exercise for those trying to stay grounded in object (Javascript/Jscript) and function (PHP) notation differences.

eg., preg_replace("/pattern/","replacement",$source);
becomes source.replace(/pattern,"replacement");
etc.

For examples of code workarounds I've built to translate PHP functionality to ASP and vice versa (like translating PHP's file() into ASP), check out: and

- [email protected]

[email protected]
15-Sep-2001 01:33

My last project requires VRML - IRC interaction ( if a user logs into an irc server a proper VRML object appears in web ... ), and i found that PHP is quite powerfull in that area as it gives the functionality to use very customizable templates to create .wrl files. It also gives very good irc analyzing to properly deliver parameters to VRML environment. And i think that PHP is a real JAVA competitor in that area. But there is still a lot of work to be done for PHP-VRML(-IRC) collaboration.
[email protected]
01-Feb-2002 03:24

What about PHP vs. JSP?
One of the problems I see in PHP is lack to support some design pattern practices like MVC.
Yes it support the use of Java classes... but how good is this support?
Can use PHP as an EJB client (COM sucks because is Win32 only)
There is any equivalent to taglibraries or the Struts framework () in PHP?
In favor of PHP... is really fast!, and easy to learn, ideal for small/medium websites...but (I think) not so good for enterprise web based applications.

[email protected]
01-Feb-2002 03:34

One other thing that should be mentioned about ASP vs. PHP is session support. I find ASPs session management to be much simpler and more intuitive. For example, if I want to get and set a variable, I do this:

Session("myVar") = "bob"
strBlah = Session("myVar")

In addition, Session variables stay around through the entire session (until the user closes the browser), so there is no need for session_start() at the beginning of each page.

That being said, I rather like PHP more syntactically and functionally. The C-like syntax is much easier for me to read and write, and the native functions it supports is... extensive to say the least.

Still, ASP has better session management.

nobody
03-Feb-2002 03:31

I disagree with [email protected] who mentioned that ASP's session is easier to use.

PHP's session management is as easy too!
to set and get a session var (similar to pyranf's example):

$_SESSION['myVar'] = "bob";
$strBlah = $_SESSION['myVar'];

what do u think?

[email protected]
02-Mar-2002 08:02

PHP is infact very powerful than ASP maybee because PHP doesn't require add-ons, The only problem i have met converting to PHP
This problem is PHP's poor support for XML and XMLDOM...if this support is available it's more diffcult to parse XML files in PHP than ASP...and as i see XML is THE FUTURE.

if you have any information concerning PHP/XML parsing please E-maill me,

[email protected]
04-Mar-2002 02:34

If you ever tried to configure a web server for WAP, serving WML content you know it's not an easy job. You can easily make dynamic WML pages for mobile phone users with PHP. All the options and extras from DB+PHP oriented web-site can easily be transfomed into a WAP version of your site. With a single line - Header("Content-type: ext/vnd.wap.wml"); you can be in another "mobile" dimension :). Take all you need ... and even more.
[email protected]
12-Mar-2002 11:32

Cold Fusion vs. PHP:
What about the price? I started a few years back designing web applications in CF with its powerful database interfacing. Convincing management to spend the money on the CF server & my app can be VERY difficult. I have since switched ALL my apps to PHP. I haven't come accross a situation it couldn't handle (granted, with a decent amount of time spent in some cases). The savings and 'sellability' well make up for slight difficulties I've had to deal with.

BB, FFASpector

[email protected]
25-Apr-2002 05:41

note to the previous comment - about the WAP and WML.
i have type'o - the right header() is :
header("Content-type: text/vnd.wap.wml");
but i wrote :
header("Content-type: ext/vnd.wap.wml");
without the "t"

[email protected]
18-Jun-2002 04:29

Will PHP support Application variables as in ASP? I hope so because ASP's Application variables with the global.asa is a powerful feature.

/Peter

[email protected]
20-Jun-2002 04:35

What about ASP.NET? Programming using C# in .NET, has the same syntax as C++. It is also much faster then ASP due to the fact that it is compiled. How does ASP.NET stack up to PHP?
[email protected]
27-Jun-2002 11:00

Well, about PHP and .NET.... I saw an article about using the COM structure for wrapping around .NET's architecture.


index.asp?product_id=
%7BD52A041D-4FCB-44C9-BE8C-
E2D446D3A999%7D&null

(sorry for cutting, otherwise it wouldn't let me submitting the text.... = ( )

Looks very odd and complicated, but as always... People who are using or even developing for PHP come up with solutions for any kind of much used technology. So just wait and see (PHP with Zend 2.+) and .NET will be supported by PHP very soon, just because Open Source is as flexible as where the main stream wants to go.

[email protected]
27-Jun-2002 11:11

Oh, BTW the other comment just posted should include mentioning that the article about PHP and .NET is also about C Sharp (C#) or VB. As long as the modules/libraries created for .NET are build with the instructions on that page they should be accessable within COM after the wrapping. That's what the article is telling me, haven't tried it myself yet, but will start with C# soon to have a look at it. If it is easy/simple, this would mean a lot of power behind PHP coming our way. And if I'am not wrong even on Linux (GTK#) the whole bunch of new tech will give us kick-ass power.
ahabra at yahoo.com
09-Aug-2002 06:46

This is a comparison between PHP and Java/JSP:



Any comments?

add a note about notes
previousPHP and COMMigrating from PHP 2 to PHP 3next
Last updated: Fri, 30 Aug 2002
show source | credits | stats | mirror sites
Copyright © 2001, 2002 The PHP Group
All rights reserved.
This mirror generously provided by:
Last updated: Sat Aug 31 06:19:44 2002 CEST