Fork me on GitHub

php scripting

Category Archives: PHP Scripting

WordPress TextMate bundle updated for WordPress 3.2

So, WordPress 3.2 has been out for a little while now and I’ve just gotten around to updating the bundle. My apologies, I’ve just been super swamped with a new job in a new city. But that’s some whining for another post. After much fiddling, the updated WordPress TextMate Bundle is here and it has […]

July 11, 2011 | PHP Scripting, TextMate, WordPress | 1 comment

WordPress TextMate Bundle Updated

WordPress 3.1 RC is here, so I figure its time enough to issue an update my [recently neglected, sorry ’bout that, its been busy] WordPress TextMate Bundle. All function definitions have been updated to the 3.1 RC code base. There is a tag for the 3.0 branch as it sat this afternoon. No new features […]

December 27, 2010 | PHP Scripting, Plugins, TextMate, WordPress | 1 comment

Quickly unserialize PHP array data in TextMate

Every once in a while I need to see what’s hiding in a serialized array in a database field and finally just wrote a little TextMate command to do the job for me. If I’m already working in that area of code its easier to just dump it someone in the page output to read […]

August 28, 2009 | PHP Scripting | 3 comments

MacPorts, php5-mysql & mysqlnd

If you don’t know what that title says, don’t bother reading on 😉 A little useless history: MacPorts decided to use the recent release of PHP 5.3 to change the way they handle PHP5 Extensions. They used to be applied by the MacPorts variants system but have been changed (and appear to still be in […]

August 26, 2009 | PHP Scripting | 4 comments

Use array_merge to reorder arrays

This one is pretty fun. Well, at least I think it is. I was working with jQuery UI Sortables the other day and getting the reordered elements from jQuery back in to PHP for reordering via Ajax I ended up with an array whose elements matched the array keys of the array that I needed […]

August 21, 2009 | PHP Scripting | 1 comment

Sort arrays by key revisited

I don’t know why but I have an infatuation with little utility functions. Its pretty stupid, but it keeps me entertained and provides me with a cheap blog post 😉 That and I’ve noticed it trending A LOT in my search keywords lately, so I figure I should post some updated and easier to use […]

July 29, 2009 | PHP Scripting | Comments Off on Sort arrays by key revisited

WordPress Clippings Bundle for BBEdit

I was having one of those never ending text editor comparison conversations at work the other day and learned that BBEdit has some pretty easy to format Clipping functionality. Since I had pretty much built a generic function parser for yanking the information that I needed out of the WordPress source files for the WordPress […]

July 24, 2009 | PHP Scripting, Web Design & Development | 3 comments

Announcing the SP Source Code Highlighter plugin for WordPress

Maybe you noticed already, maybe you didn’t (I’ll wager on the latter 😉 ) that recently this site got new source code highlighting in posts. Or, should I say, that it GOT source code highlighting in posts. I had made a simple Script Source viewer a while back. Something simple and straight forward that I […]

July 7, 2009 | Code, PHP Scripting, Plugins | 1 comment

Quickly validate PHP files

Ever needed to quickly scan a directory full of PHP files for syntax errors? You can do this quickly on a *nix command line with:  find . -type f -name \*.php -exec php -l {} \;

June 26, 2009 | Computers, PHP Scripting | 3 comments

WordCamp Denver, 2009. My humble experience.

Amazingly enough I had the opportunity to speak at WordCamp Denver. As nervous as I was before hand (I very well could have puked) I came out pumped. Hopefully a few others did as well.

March 2, 2009 | PHP Scripting | 3 comments

Stupid ASCII Addition Answer Page

So, I found a neat little math trick this morning that would build numbers out of ascii characters, so I modded it to respond to user content. Sound riveting and useless? Ya, well, it is. But it kept me entertained making it. The Stupid ASCII Addition Answer Page. Update: 2009-02-20 And then there’s the analytics… […]

February 17, 2009 | PHP Scripting | Comments Off on Stupid ASCII Addition Answer Page

File upload class – it is fixed!

After a long time of knowing there was an issue with the script I finally got around to checking it out. Its a little embarrassing to say, but, here’s the dish: I wrote all the functionality to check the file type, but forgot to actually implement it… oops. The file is correct now, so to […]

August 30, 2007 | PHP Scripting | Comments Off on File upload class – it is fixed!

Case Insensitivity and a bite in the ass

I made a disturbing discovery lately and I can’t believe that it has taken me this long to run across it. Case insensitivity in OS X can play havoc with a website, like completely bring it down, if any capitalization errors are made and not caught before moving to a case-sensitive server, like a unix […]

March 16, 2007 | PHP Scripting | 4 comments

Classes for file uploading in PHP

Surprisingly, I still get a lot of referrals from The Stickman for his work on a multi-file javascript upload helper on which I briefly assisted on Safari compatibility. The script adds and removes file upload form elements as requested by the user. So a form can be designed to handle as many uploads as you’d […]

December 22, 2006 | PHP Scripting | 45 comments

Convert file size denominations in PHP

Convert a file size from one measure to another. For example, take a file that is recorded as 512KB and have it converted to .5MB. Yeah, that’s an easy example, but that’s ’cause I was writing it off the top of my head. So, if you need this sort of thing, here’s a function that […]

December 20, 2006 | PHP Scripting | Comments Off on Convert file size denominations in PHP

5.2 or not 5.2, that is the question…

I so badly want to start using some of the new features in PHP 5.2 but don’t want to get too far into it before our web host at work makes the switch. After all, they’re still on PHP 5.1.1. With so many neat additions to the language its hard to resist, but I don’t […]

December 6, 2006 | PHP Scripting | Comments Off on 5.2 or not 5.2, that is the question…

Show PHP source without duplicating files

Every once in a while I want to show a php script’s source code. I would always have a .php file to show an active file in use and a companion .phps file (php-source) to show the source. With a little mod_rewrite and php this can be done with just the one active file, and […]

November 22, 2006 | PHP Scripting | Comments Off on Show PHP source without duplicating files

PHP: Sort Multidimensional arrays by key

Update 2009-07-29: This code has been updated and posted here: Sort Arrays by Key Revisited. So, I had to do some array sorting this week and finally bit the bullet and wrote a class to handle it. If you’ve got the need to sort a multidimensional array by a sub-array key then this might be […]

November 8, 2006 | PHP Scripting | Comments Off on PHP: Sort Multidimensional arrays by key

Is this a normal coding enviroment?

Or: Editors, Editors Everywhere. Go Nuts I know I’ve done an "Editor Roundup" before, but: Doing work in a variety of languages has had me jumping editors and IDEs looking for the single perfect editor for handling PHP, HTML, CSS, JavaScript, SQL and the occasional Bash script. I recently gave up and just settled on […]

August 14, 2006 | PHP Scripting | 4 comments

Oh, crap. No wonder I’ve been feeling neglected…

And here I thought nobody loved me anymore. In my ongoing attempts to hold off comment spam I went ahead and screwed up the comment script and accidentally created a condition that would never evaluate to true and thus would never allow a comment to be posted. Damn…

April 15, 2006 | PHP Scripting | 8 comments

mySQL Class Updated for PHP 5 part 1

I’ve updated the SQL class to use some native PHP 5, namely constructors and destructors and include some backward compatibility so PHP 4 does not freak out when it loads the class. I’ll hopefully be making this 100% PHP 5 native soon enough as I’ll actually have a native PHP 5 environment to apply it […]

March 6, 2006 | PHP Scripting | Comments Off on mySQL Class Updated for PHP 5 part 1

Well, that was easy…

For a while here at work I’d been struggling with the best way to deliver content to Excel users so they could further manipulate or repurpose the data. The best thing I’d found had been to deliver an Excel content header on a tab deliniated string of data from the database. Well, in a stroke […]

February 3, 2006 | PHP Scripting | Comments Off on Well, that was easy…

Alternate Syntax for PHP Control Structures

I posted a link to this in my links section but get excited about it every time I use it, so I have to post a blurb on it here just in case any PHP geeks that read this didn’t click the link. Its cool, dammit! Really, it is. No more curley braces for if, […]

November 17, 2005 | PHP Scripting | 5 comments

mySQL Class Updated

The change is minor but has significant meaning to the script. I added two functions – escapeData() and buildQuery(). The significance of adding these is mainly in the escapeData() function. Instead of encouraging the user the use addslashes before using submitted data or, worse yet, encouraging the user to rely on magic_quotes, the escapeData function […]

September 12, 2005 | PHP Scripting | 7 comments

Text editors galore

This is a post spurred into existence by not being able to post my complete views in a comment box on Jon Hicks’ recent article about an ideal text editor for OS X (I hate to name drop but didn’t have much choice here). I’ve been wanting to write this for some time and his […]

September 11, 2005 | PHP Scripting | 6 comments