Skip to main content

Posts

Showing posts with the label PHP

PHP-FIG, Composer, and other disasters from the last decade of PHP

Let's talk about PHP. The scripting language , not the health insurance . PHP is, in my opinion, one of the greatest development tools ever created. It didn't start out that way, which is where most of its bad rap comes from , but it has transformed over the past decade into something worth using for any size project (and people do!). More specifically, I've personally found PHP to be an excellent prototyping and command-line scripting tool. I don't generally have to fire up Visual Studio to do complex things because I have access to a powerful cross-platform capable toolset at my fingertips. It's the perfect language for prototyping useful ideas without being forced into a box. BUT! Some people WANT to force everyone into a box. Their box. Introducing the PHP-Framework Interop Group or PHP-FIG. A very professional sounding group of people. They are best known as the folks who produce documents called PHP Standard Recommendations aka PSRs. This group...

Forget flock() and System V Semaphores - use WebMutex instead

While developing my latest PHP-based project, WebCron , I ran into an issue that has bothered me for a while - atomicity. An atomic operation is one where only one thread of one process is allowed to execute some piece of code. Actually, even under C/C++, I've been bothered by this issue. Unlike Linux, Windows really has the most friendly approach to creating an environment where atomic operations may thrive. Named mutexes is one area where Windows really, truly shines above all the OSes out there. Try porting CreateMutex () to another OS and you'll inevitably have some real head-scratching sessions when you try to do a cross-process, named mutex. So-called 'mutexes' under *NIX OSes are usually ' pthread '-based, which are really more in line with Windows " critical sections " than "mutexes". A programmer coming from the Windows world is going to be utterly confused because they've been pampered by Microsoft and no one in the Linux ...

Time Waster: X-PHP-QUESTION - Yes, I did notice

Welcome to Time Waster article #1. Time Waster is going to be where I put weird little easter eggs as I find them. Either programming hiccups or weird software oddities that caused me to waste time. Today's Time Waster involves the PHP website itself. To participate, you will need Firefox with the Firebug plugin installed. Visit the PHP website in Firefox. Now, open up Firebug and you should see something like this: (Why, yes, I did notice.) A few other people have noticed this. Looking at the source code for their site doesn't have any explanation for its existence. Someone on the PHP developer team thinks they are cute .

Maximum failure: PHP 6 deprecates short tags

I just discovered that PHP 6 is officially deprecating short tags. I'm sorry, but short tags are incredibly useful. They should be turned on for every server. They simplify coding dynamic actions within HTML. Plus, you get the added bonus of using: <?=$x?> Which is short for: <?php echo $x; ?> Compare: 7 characters vs. 17 characters. The latter is over twice the length, quite unreadable, and, from personal experience with large code bases, unmaintainable! Typing 'php echo' in every time I want to execute/display data that is hosted within the PHP engine is ridiculous. This is a step backwards going in the wrong direction. The lame excuse for removing short tags is XML. PHP is for HTML, not XML. I write PHP code quite regularly. Prior to PHP 5, PHP stunk. PHP 5 really changed my view of scripting languages. PHP 6 is going to ruin that view as we will return, once again, to the dark ages of software development. What really gets me is that someone made a decent r...