Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 PHP


  PHP sucks (but, some frameworks don't)

I started web development with PHP, and I've decided I've had enough. Why? Keep reading.PHP (the language) sucks. There, I said it. 1029380128301928301823 GlobalsObject system hacked onC extension system sucksDocumentation sucks (read more; no, I'm not drunk)Has a terrible communityAll in all, designed by total idiots. You've probably heard this a ton of times before, but, here it is again. THERE ARE JUST WAY TOO MANY GLOBALS. Why in the world does md5() need to be global? Do you seriously use md5() in every single file?This is also a common occurrence, why on the planet are things l...

8,614 0       PHP GOOD FRAMEWORK SUCKS BAD DESIGN


  How to hide PHP Notice & Warning Messages

How to hide PHP Notice & Warning Messages. The PHP notice errors are frustrating and you are tired of seeing them when you are working on your scripts. They are showed at the beggining of your pages and may reveal confidential information to the visitor like the path to the file or the php file name in some cases.// Turn off all error reportingerror_reporting(0);// Report simple running errorserror_reporting(E_ERROR | E_WARNING | E_PARSE);// Reporting E_NOTICE can be good too (to report uninitialized// variables or catch variable name misspellings ...)error_reporting(E_ERROR | E_WARNING | ...

7,048 0       PHP METHOD ERROR WARNING DEPRECATED HIDING


  Creating Dynamic PDF files using HTML and PHP

There always arise a need for converting content from one file format to another one. Some may need to convert some text into HTML and some may need to convert some HTML content to an image format. The main reason for the need to convert from one file format to another is because the target file format is best suited for targeted medium where the content need to be displayed. The targeted medium may be an email, a printed hard copy or a web browser. The text format is best suited for sending emails, as the possibility of the email contents getting corrupted in the transition is much lesser, wh...

7,928 0       PHP HTML LIBRARY PDF CONVERSION GENERATE


  Php Class to Retrieve Alexa Rank

Alexa is a service acquired by Amazon which offers a web traffic report for websites. They retrieve the data from toolbar that can be installed in different browsers, centralize the data and display reports to anyone. The most important indicator is the Alexa Rank. It represents the rank of a webpage in a list of all the websites. It’s not the 100% accurate but it gives a good indication.Alexa does not offer any free API to obtain Alexa Rank. However there is a simple method to obtain it in the same way the Alexa Toolbar does. All you have to do is to invoke the following url(replacing ...

3,759 0       PHP API ALEXA ALEXA RANK RETRIEVE ALEXA RANK


  Date interval add and sub prior to PHP 5.3

After PHP 5.3, we can use DateInterval object or date_interval_create_from_date_string() function to add or subtract days,weeks,months or years to or from a DateObject.But prior to PHP 5.3,we cannot do this. If we want to achieve the same effect. We need to use some skills. Here is one:We can use strtotime() function to achieve this. For example:$date=date('Y-m-d',time());$datestamp=strtotime(date('Y-m-d',strtotime($date)).' +1 day'); $datestamp=strtotime(date('Y-m-d',strtotime($date)).' +1 week');  $datestamp=strtotime(date('Y-m-d',strtotime($date)).' +1 month');  Her...

11,646 0       PHP CLASS DATEINTERVAL PHP 5.3 PHP 5.2


  Using DateInterval class in PHP

DateInterval is (amongst others) a relatively new addition to the date extension in PHP 5.3. It allows to describe an interval in time, and you can perform actions with that interval. Basically, it allows to calculate with dates in a very easy way, and do even more fun stuff with it.Unfortunately no documentation exists today for DateInterval and friends, but PHP is open-source so you can easily have a peek at the code to see what’s happening under the engine. This is more or less what the documentation for DateInterval and some helper functions could look like:Prototype:DateInterval Da...

5,323 0       PHP DATEINTERVAL CLASS PHP 5.3 DEMO


  Dates in PHP and MySQL

I see a lot of people on forums and on my training courses asking about the best way (or any way) to manage dates stored in a MySQL database and used in PHP. Three options follow, but first the problem.PHP uses unix timestamps for all its date functionality. It has methods to convert these timestamps into pretty much any text format you could want but internally it uses the timestamp format. A timestamp is simply an integer. Specifically, it’s the number of seconds that have elapsed since midnight on January 1st 1970 (greenwich mean time).MySQL has three date types f...

2,852 0       PHP COMPARISON MYSQL DATE FORMAT DATE DATE COMPARE


  Multiple Constructor in PHP

See code:class MultipleConstructor {private $info = ”;function __construct() {$argv = func_get_args();switch( func_num_args() ){default:case 1:self::__construct1($argv[0]);break;case 2:self::__construct2( $argv[0], $argv[1] );break;}}function __construct1($value) {$this->info = $value;}function __construct2($value, $value2) {$this->info = $value . ” ” . $value2;}function get() {return $this->info;}}$a = new MultipleConstructor(‘Value 1′);echo $a->get();$b = new MultipleConstructor(‘Value 1′, ‘Value 2′);echo $b->get();Viola!!!...

9,237 0       PHP CONSTRUCTOR MULTIPLE CONSTRUCTOR