WebConsults.EUQuicksearchKategorien |
Friday, June 13. 2008strstr type problem
Well using strstr function i found a variable type handling problem
PHP Version 5.1.2
try
$intSomeID="4";
$strCatList="4,5,6,7";
while
//unexpected behavior
var_dump(strstr($strCatList,$intSomeID)); returns bool(false)
//right behavior
var_dump(strstr($strCatList,"$intSomeID")); returns string "4,5,6,7";
well i always used strstr to string comparsion if something is included inside string and never hat this array before.
Usually you could implode the categorys to an array and use in_array function but it is not needed in that point.
So you have to take care with your variable types using strstr functions.
I wouldn´t call it a bug but something where you have to take care off.
Wednesday, June 11. 2008Legacy of the Past will be challenges of the Future
I just read about the 10th Birthday of PHP Lib
As a up to date PHP Developer i always like to use newest functions, features and techniques. But unfortunately at some projects this isn´t possible. Like some companies do not always use the newest PHP Version. Well usually you could install it but there might be some scripts which will cause problems on a new version.
Like i had the problem on a project where i had to work on PHP for which is running for years and they didn´t wan´t to change to PHP 5 cause there were some third party library's not supporting it. Thinks like that force you to step someway backward in technology and to abstain from using newest technologies.
If there is a project just functional coded, without OOP, without a structure which divides PHP HTML code.
Of cause you could refactor the Project using newest technologies, like MVC Pattern, Templates and so on but mostly it will not be possible in the time you were asked to do it so unfortunately you´ll have to handle the old spaghetti code.
So you have to find solutions which are not touching the complete old code but building up new features in a way they are a bit more maintainable then the old code. You could use a cool Framework like Zend or maybe Template System like smarty, but it doesn´t make the code more readable for somebody who doesn´t know these things, and even if it´s just a small feature which you add it´s more overhead than usage.
From my impression at the moment the ability to code inside old projects will be highly requested the next common years. There is already a lot of undocumented legacy code written by people who maybe did PHP or even programming at all for first time, with a lot of bad coding behaviors and even wholes in security. So what will be really interesting is not always building the newest and best the future technology but how can i manage to bring also code form the past up to date. Today theres Zend Framework, Symfony or maybe cake up to date but what in about 2,5 or 10 years, they might be as popular as PHPLib is now but there will be some code left.
Thursday, June 5. 2008What's new: PHP 5.3 in detail - get_called_class()While the first PHP5.3 release candidate is right round the corner, we're going to explain you some benefits of the new features and language constructs in our new series "What's New: PHP 5.3 in detail". Every developer, that is a little bit into PHP & design patterns, should stumbled about this issue: How the heck can i implement a singleton method into my abstract class. Caused by internal handling in PHP prior to version 5.3, it wasn't possible to do it without dirty workarounds (e.g. propertys with className)
Continue reading "What's new: PHP 5.3 in detail - get_called_class()" Wednesday, June 4. 2008OpenID Article on Zend Developer Zone
Vikram Vaswani Posted an Interesting Article "Getting Started with OpenID and PHP" on ze Zend Developer Zone
Giving example of an OpenID loggin mechanism using the PHP OpenID Library's file storage class or alternatively the PearAuthentication::OpenID_Consumer PEAR
« previous page
(Page 2 of 2, totaling 19 entries)
|