Tag Archives: php

Finding PHP Short Tags

There are a number of ways to escape between PHP and output (usually HTML) mode. Personally I recommend sticking with the traditional <?php style. One method that can cause problems is the so called ‘short tag’ style – <? and … Continue reading

Posted in Posts | Tagged , | 6 Comments

WordCamp SF 2010 Presentation Video

From WordPress.TV. I’ll never get used to watching myself on video.

Posted in Posts | Tagged , , , , , , , | 2 Comments

Slides: Anatomy of a PHP Request

Here are the slides from my presentation last week at UPHPU – Anatomy of a PHP Request View more presentations from josephscott. I added it to my slides page.

Posted in Posts | Tagged , , , | Leave a comment

Utah PHP Users Group Presentation: Anatomy of a PHP Request

I’ll be presenting at the next Utah PHP Users Group (UPHPU) meeting on Anatomy of a PHP Request: Ever wondered what really happens when your PHP script runs? I’ll cover the major milestones in the life and times of a … Continue reading

Posted in Posts | Tagged , , | 2 Comments

Efficient PHP: Don't Abuse dirname( __FILE__ )

Every now and then I run across a chunk of PHP code at the top of a file that looks something like this: require dirname( __FILE__ ) . ‘/path/to/something.php’; require dirname( __FILE__ ) . ‘/path/to/another.php’; require dirname( __FILE__ ) . … Continue reading

Posted in Posts | Tagged , , | 8 Comments

PHP Tip: Spaces Are Not empty()

It can be really easy to get tripped up by PHP’s empty and isset functions. I just came across a bug in some code that was using empty() to check for something so I thought this was a good time … Continue reading

Posted in Posts | Tagged , | 3 Comments

PHP Helpers: curl_http_request

cURL is one very handy program and library, I love having access to in PHP. It has a ton of options though, and I can never seem to remember to flip the right knobs without reviewing the options list. 99% … Continue reading

Posted in Posts | Tagged , , , | 4 Comments

Database Indexes on Domain Names

As part of a separate conversation Matt suggested something I had not given much thought to before. Say you have a database column that is used to store domain names. Something as simple as `domain` varchar(255) NOT NULL. Of course … Continue reading

Posted in Posts | Tagged , | 6 Comments

PHP Helpers: make_slug

New function, make_slug – if ( !function_exists( ‘make_slug’ ) ) { function make_slug( $str ) { $url_str = strtolower( trim( $str ) ); $url_str = preg_replace( ‘/[\s_]+/’, ‘-’, $url_str ); $url_str = preg_replace( ‘/-{2,}/’, ‘-’, $url_str ); $url_str = preg_replace( … Continue reading

Posted in Posts | Tagged , , | 2 Comments

PHP Helpers: redirect_url

New function: redirect_url if ( !function_exists( ‘redirect_url’ ) ) { function redirect_url( $url, $status = 302 ) { header( "Location: {$url}", TRUE, $status ); exit; } } A special case wrapper around the header function to do URL redirection. I … Continue reading

Posted in Posts | Tagged , , | Leave a comment