[PHP] Re: php 4 to 5
Travis Conway wrote: I do not know much about the history of php and do not know why there is active development on both the 4 and 5 major versions, but is there a definite reason for me to migrate from 4 to 5 on my servers? Depends on what you wish to do with php. PHP 5 has far better support for xml and soap than php 4. It has a stricter object model and supports native exceptions for error handling. Iterators, reflection, and __call()/__get()/__set() provide incredibly flexibility. It is new, and so not nearly as stable as PHP 4. Any solutions would need to be custom-written for PHP 5 at this point, although options are beginning to appear. PHP 4 has a big history and is very stable. There are shortcomings that are addressed in PHP 5, but there is a huge codebase. So, the question is, do you rely on other people's code, or your own? If you rely on other people's code, I would wait a year or two to upgrade. Otherwise, what are you waiting for? :) Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php 4 to 5
Travis Conway wrote: I do not know much about the history of php and do not know why there is active development on both the 4 and 5 major versions, but is there a definite reason for me to migrate from 4 to 5 on my servers? Trav here can help you . http://www.php.net/manual/en/history.php http://www.php.net/manual/en/migration5.php http://www.php.net/manual/en/language.oop.php http://www.php.net/manual/en/language.oop5.php -- -- ShenKong ([EMAIL PROTECTED]) -- http://www.openphp.cn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php 4 to 5
Well, I look at other people's code sice I am new to the whole language. I have only been working with it for about a month and half now. I do have prior experience with languages such as ASP (both JScript and VBscript based). I am probably not going to upgrade now since my stuff "just works". I was just wondering what would be the main advantage. - Original Message - From: "Greg Beaver" <[EMAIL PROTECTED]> To: "Travis Conway" <[EMAIL PROTECTED]> Cc: "PHP-GEMERAL" <[EMAIL PROTECTED]> Sent: Sunday, November 28, 2004 6:15 PM Subject: [PHP] Re: php 4 to 5 Travis Conway wrote: I do not know much about the history of php and do not know why there is active development on both the 4 and 5 major versions, but is there a definite reason for me to migrate from 4 to 5 on my servers? Depends on what you wish to do with php. PHP 5 has far better support for xml and soap than php 4. It has a stricter object model and supports native exceptions for error handling. Iterators, reflection, and __call()/__get()/__set() provide incredibly flexibility. It is new, and so not nearly as stable as PHP 4. Any solutions would need to be custom-written for PHP 5 at this point, although options are beginning to appear. PHP 4 has a big history and is very stable. There are shortcomings that are addressed in PHP 5, but there is a huge codebase. So, the question is, do you rely on other people's code, or your own? If you rely on other people's code, I would wait a year or two to upgrade. Otherwise, what are you waiting for? :) Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php 4 to 5
Travis Conway wrote: Well, I look at other people's code sice I am new to the whole language. I have only been working with it for about a month and half now. I do have prior experience with languages such as ASP (both JScript and VBscript based). I am probably not going to upgrade now since my stuff "just works". I was just wondering what would be the main advantage. I switched to PHP over a year ago, and decided that as I was just starting I'd work with PHP5 from day one. The production releases just about kept pace with what I had to ship ( couple of sites used RC without problems for a while ). If you ARE just starting then while the volume of PHP4 code is nice, working clean with PHP5 is not a problem. All my stuff 'borrows' from PHP4 without any problem, and I am learning quickly how to switch to tidier PHP5 'rules'. I actually bought a book to help - Advanced PHP Programming by George Schlossnagle - from which I've had to rewrite some of the stuff to dump the MySQL crap ;) but gives a good grounding in getting things right. -- Lester Caine - L.S.Caine Electronic Services -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP 4 to 5 class issues involving static methods and $this
Chris wrote: I have a class where I need to be able to use the methods as static methods as well as using them inside an initialized class. Here's an example of what I need to do: class my_class { var $elements = array(); // holds all of my elements function format_string($string) { // format the string... return $this->elements[] = $string; } function show_all() { return implode("\n", $this->elements); } } This worked fine in PHP 4. It silently ignored the $this->elements[] assignment in statically called methods and just returned my formatted string without any fuss. However, in PHP 5, I understand that I'm now required to declare the method format_string as public static if I want to just call my_class::format_string(), and if I want to use $elements inside a static method, it also requires being declared as static. I also understand that I can't use $this inside a statically called method. I've tried these things, but they don't seem to help. How can I rewrite my class for PHP 5 to emulate the functionality I had in PHP 4 in an error free way? elements[] = $rm->invoke(null, $args); } catch (ReflectionException $e) {} } } static_my_class::format_string('a'); $a = new my_class; $a->format_string('a'); ?> Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php