Ternary Operators Anyone?

While reading through the WordPress Coding Standards, I read some good advice to follow when using ternary operators. To keep things from getting confusing when using ternary operators, always have the statements test for true instead of false. // (if statement is true) ? (do this) : (if false, do this); $basketballteam = ( ‘lakers’ [...]

Search in File Contents in Windows

search-in-file-contents

Problem By default, Windows will not search the contents of certain file types. This makes it very frustrating for anyone trying to locate the occurrence of words or phrases within a group of files. A Few Details First off, I am running Windows 7 and since I am a PHP developer, the solutions I provide [...]

How to Disallow Direct Access to a File with PHP

Place this code at the top of your PHP script. if ( stristr( $_SERVER['SCRIPT_NAME'], basename( __FILE__ ) ) ) { exit( ‘No direct script access allowed’ ); }

Search for Text Inside of PHP Files with Vista

Search within PHP files

Problem Windows ignores text inside of PHP files because it doesn’t recognize them. This makes it very difficult to search for specific words or phrases inside of PHP files. Solution If you have Windows Search Indexing disabled, view this solution. Otherwise continue with the steps below. Perform a search on the Start Menu for “indexing”. [...]