473,956 Members | 54,350 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP5 - *ANY advantage??

Hello,

php5 is in everybodies mouth - but what are the *real* advantages and
plus' compared to php4?

mikel
Jul 17 '05
28 3687
With total disregard for any kind of safety measures nc@iname.com
(Nikolai Chuvakhin) leapt forth and uttered:
If you understand OOP, you will still be
wondering how much sense OOP makes without strong typing.
SmallTalk is regarded as one of the most Object Oriented languages
available. It does not use strong typing, but dynamic types. Just
like PHP.
you don't like OOP, it'll be a huge disappointment: slightly
larger system footprint, but no additional functionalilty; just
another step along the way of turning PHP into a Java clone.


You sound rather bitter, did Java steal your girlfriend or
something?

--
There is no signature.....
Jul 17 '05 #21
Nikolai Chuvakhin <nc@iname.com > wrote or quoted:
mi****@komatia. com (mikel) wrote:

php5 is in everybodies mouth - but what are the *real* advantages
and plus' compared to php4?


If you like OOP, you'll probably get a kick out of the new object
model. If you understand OOP, you will still be wondering how
much sense OOP makes without strong typing. If you don't like OOP,
it'll be a huge disappointment: slightly larger system footprint,
but no additional functionalilty; just another step along the way
of turning PHP into a Java clone.


Better an unencumbered Java clone than a hastily-hacked-together
scripting language, hey?
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #22
Nikolai Chuvakhin wrote:
just another step along the way
of turning PHP into a Java clone.


We have to learn Java somehow, and we sure can't via Sun's tutorial. :)

Jul 17 '05 #23
Keith Bowes <do****@spam.me > wrote or quoted:
We have to learn Java somehow, and we sure can't via Sun's tutorial. :)


http://www.mindprod.com/jgloss/jgloss.html can be useful.

It's curious how Apache are supporting both Java and PHP.

It must produce some level of schizophrenia internally.
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #24
The features I'm looking forward to using are destructor and property. They
allow you to very neatly encapsulate your database access code. Say you're
writing a message forum webapp. You would have a Message class that looks
something like this:

class Message {
private $values;
private $columns_change d;
private $primary_key;

function __destruct() {
if($this->primary_key) {
$this->DoDBUpdate() ;
}
else {
$this->DoDBInsert() ;
}
}

function DoDBUpdate() {
foreach($this->columns_change d as $column) {
...
}
}

function __set($name, $value) {
if($this->values[$name] != $value) {
$this->values[$name] = $value;
$this->columns_change d[] = $name;
}
}

function __get($name) {
return $this->values[$name];
}
}

To insert a message, you'll would do something like:

$msg = new Message();
$msg->title = $_POST['title'];
$msg->text = $_POST['text'];

Assignments to the undeclared variables title and text triggers the objects
__set() function, which records the names of these properties so that it
knows which table columns to update. When the object is destroyed, the
destructor is triggered, which save the changes to the database.

Property access is great in that it fits in perfectly with one of PHP's
great strength: variable interpolation (i.e. sticking variables into
double-quoted strings). You can now, in essence, call a function from within
a string. Using the message forum example again: When you out put a message,
you'll find inevitably that you need to do a htmlspecialchar s() on most
properties of Message. In PHP4, you would have to either use a lot of
temporary variables or break up your strings into ugly fragments ( "<h1>" .
htmlspecialchar s($msg->title) . "</h1>" ). In PHP5, you can modify __get()
like this:

function __get($name) {
if(substr($name , -5) == '_html')) {
$need_htmlspeci alchars = true;
$name = substr($name, 0, -5);
}
$value = $this->values[$name];
if($need_htmlsp ecialchars) {
$value = htmlspecialchar s($value);
}
return $value;
}

so that all you have to do is to append the suffix '_html' to a property
name to get it properly escaped ( echo "<h1>$msg->title_html</h1>" ).

Uzytkownik "mikel" <mi****@komatia .com> napisal w wiadomosci
news:e9******** *************** ***@posting.goo gle.com...
Hello,

php5 is in everybodies mouth - but what are the *real* advantages and
plus' compared to php4?

mikel

Jul 17 '05 #25
"rush" <pi**@rush.aval on.hr> wrote in message
news:<bq******* **@ls219.htnet. hr>...
"Nikolai Chuvakhin" <nc@iname.com > wrote in message
news:32******** *************** ***@posting.goo gle.com...
If you like OOP, you'll probably get a kick out of the new object
model. If you understand OOP, you will still be wondering how
much sense OOP makes without strong typing. If you don't like OOP,


Well, there are quite a few people who make this queston other way
around, how mocu sense does OOP make with strong typing? Especially
inventors of OOP like Alan Kay.


Last time I heard, invention of OOP was attributed to Niklaus Wirth...
But, then, I may be listening to wrong people... :)

Cheers,
NC
Jul 17 '05 #26
Phil Roberts <ph*****@HOLYfl atnetSHIT.net> wrote in message
news:<Xn******* *************** ***@206.127.4.2 2>...
With total disregard for any kind of safety measures nc@iname.com
(Nikolai Chuvakhin) leapt forth and uttered:
another step along the way of turning PHP into a Java clone.


You sound rather bitter, did Java steal your girlfriend or
something?


Honestly, I could not care less about Java; it exists in a universe
totally separate from mine. The reason I am bitter is because the
current PHP team seems to develop PHP in ways that are totally
irrelevant to me and my needs. For example, I would rather have
PHP totally void of OOP, but with a good statistical library
included in the standard distribution (good statistical libraries
are not object-oriented anyway).

Cheers,
NC
Jul 17 '05 #27
Tim Tyler <ti*@tt1lock.or g> wrote in message
news:<Hp******* *@bath.ac.uk>.. .

It's curious how Apache are supporting both Java and PHP.
It must produce some level of schizophrenia internally.


No it shouldn't. Apache simply decides which module to call
to parse a file with a particular extension. And options
may, in additions to Java and PHP, include SSI, Perl, Python,
etc...

Cheers,
NC
Jul 17 '05 #28
Nikolai Chuvakhin <nc@iname.com > wrote or quoted:
Tim Tyler <ti*@tt1lock.or g> wrote in message

It's curious how Apache are supporting both Java and PHP.
It must produce some level of schizophrenia internally.


No it shouldn't. Apache simply decides which module to call
to parse a file with a particular extension. [...]


I mean within the Apache Software Foundation - e.g. when it comes
to allocating funds.
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #29

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3122
by: Andrew Crowe | last post by:
Hi guys, As PHP5 is on its final beta, we decided to start writing a web application in it to take advantage of the much better object support it offered. We're running the php-5.0.0b3-Win32.zip installation on a Win2K server platform alongside PHP4. I have used a hex editor to change instances of php.ini to ph5.ini in php4ts.dll so that the existing PHP4 installation is not affected.
8
3001
by: Rob Ristroph | last post by:
I have tried out PHP 5 for the first time (with assistance from this group -- thanks!). The people I was working with have a site that uses lots of php objects. They are having problems with speed. They had a vague idea that PHP5 has improved handling of objects over PHP4, so it would probably be faster also. In fact it seems slower. We did a few timing loops, in which a a number of objects were created and and members were...
11
10604
by: neur0maniak | last post by:
Hi, I've been eager to try out PHP5, so I've dumped it on my little dev machine. It's running WinXP with IIS5. I've put the php-cgi.exe in the "mappings" page as I'm used to doing with PHP4. I've got my php.ini all set in C:\Windows. I created an index.php containing: <?php phpinfo(); ?> When I try to view the page, I get "HTTP 400 - Bad Request".
4
5848
by: badbetty | last post by:
Dear Googlers I have installed PHP5 to run on WinXP against Apache 2. It works! ie. I have tested a few simple scripts and a basic xml document parse. I now want to try the XSL extension so I can transform xml docs. Having copied the php_xsl.dll to a directory where it can be found and done the uncommenting in php.ini, it still will not work. The script I
2
2195
by: Zurab Davitiani | last post by:
Hello group(s), I just released the new beta version of ActiveLink PHP XML Package that works in both PHP4 and PHP5. The package is not dependent on any other XML extensions or libraries and is completely written in PHP. If anyone is interested in testing the beta version, please do so. You can get the 0.4.0-beta version from: http://www.active-link.com/software/
12
3645
by: Sarah Tanembaum | last post by:
Though I installed MySQL5 and PHP5, how come my phpinfo() shows as follow: MySQL Support enabled Active Persistent Links 0 Active Links 0 Client API version 3.23.57 <<<<<<<<<<<<<<< Instead of saying 3.23.57, shouldn't it show 5.xx.xx? Or, did I do something wrong?
5
2178
by: Aziz | last post by:
Hi, I've recently contacted technical service of a web hosting company and asked them wheter or not they're gonna upgrade to PHP5 and MySQL5. Here's a quote from their response which confused me a little: "As php5 and mysql5 are still beta versions we don't install beta versions on production servers due to secure reasons, we install only current working versions on production servers"
0
1226
by: Tim Meader | last post by:
Hello, I was hoping someone could provide some insight as to the best approach to take in porting over a function I use in quite a few spots from PHP4 to PHP5. Basically, I have a db wrapper class that I use called DBConn (this is the PHP5 ported definition for the members, PHP4 was the same except "private" was "var"): class DBConn { private $hDB; //db link private $bConnected; //db link status
3
3315
by: xhe | last post by:
I have just upgraded my php version form php4 to php5. and I met this problem, and don't know if you know the solution. My site was written in PHP4, and most parts can be running smoothly in PHP5, only that in old version, I can use $row to access the data in database directly, no need to put double quote around fieldname. BUT in PHP5, this is wrong, I got error message "undefined constant". I know this is because PHP5 see the fieldname...
0
10212
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11636
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
11418
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10737
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8307
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6258
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6380
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4582
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3584
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.