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,674 0       PHP GOOD FRAMEWORK SUCKS BAD DESIGN


  PHP advisory file lock : flock

When we process a file in PHP, we may often need to acquire a lock so that other scripts cannot edit the same file at the same time. There is a flock() function in PHP which can help us lock the file we want to process. But there is one issue we should take care.Recently, ffb encountered one issue while he was trying to lock a file handle. The codes are below:$filename = "/tmp/lock.txt";    $fp = fopen($filename, "r+");  if (!$fp) {      die("open failed.");  }    i...

8,187 0       PHP FLOCK() ADVISORY LOCKING


  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,953 0       PHP HTML LIBRARY PDF CONVERSION GENERATE


  How to send asynchronous requests in PHP

It’s easy to make asynchronous calls in PHP with just a little bit of HTTP header knowledge and some library code around PHP sockets.This technique is useful when posting requests to your own server for bits of logic you’d like to run in the background.  If you don’t control the endpoint, you might not be comfortable with some of the limitations, such as the inability to read anything from the response.  So, you couldn’t post data to a webservice and receive an HTTP 200 OK response and certainly not an ID for an object newly created by the serv...

7,918 0       PHP SOCKET ASYNCHRONOUS REQUEST


  What does session_destroy() do in PHP?

In PHP manual, the description for session_destroy() function is :session_destroy() destroys all of the data associated with the current session. It does not unset any of the global variables associated with the session, or unset the session cookie. To use the session variables again, session_start() has to be called.I am confused about this description. If this function destroys all session data, then why the global variables associated with the session are not unset? Why can we use the session variables again?If we read the description carefully, we can find what this function does...

7,452 0       SESSION_DESTROY SESSION_START


  Why hasn't Facebook migrated away from PHP?

The reason Facebook hasn't migrated away from PHP is because it has incumbent inertia (it's what's there) and Facebook's engineers have managed to work around many of its flaws through a combination of patches at all levels of the stack and excellent internal discipline via code convention and style - the worst attributes of the language are avoided and coding style is rigidly enforced through a fairly tight culture of code review (failing to adhere to the style and "going cowboy" by writing sloppy code results in pitiless mockery by one's peers).  Engineering management has never had to ...

7,393 0       PHP FACEBOOK MIGRATION BAD FEATURE CODEBASE


  10 rules of PHP-masters

1. Use PHP only when it is necessary – Rasmus LerdorfThere is no better source than the creator of PHP, to learn what he can do. Rasmus Lerdorf created PHP in 1995. Since then, the language has spread like a wildfire rate in the developer community, incidentally changing the face of the Internet. However, Rasmus did not create PHP with these intentions. PHP was created for the needs of web development. As is the case with many other projects with open source, have become popular, philosophy or even narcissism has never been the driving force. It wa...

7,168 0       PHP EXPERIENCE ADVICE MASTER


  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,104 0       PHP ERROR WARNING DEPRECATED HIDING METHOD