How To Write A Function In PHP

PHP allows developers to write a variety of different styles of code: procedural, object-oriented, or simply scripts. This flexibility makes PHP easy to learn, and also means that new developers to PHP may not be programmers in other languages.
(more…)

Monday, October 12th, 2009 @ 1:00 am | Comment (11) | Categories: Technology, General PHP
Tags: , , ,

To The New PHP Programmers…

Nearly five years ago I started writing PHP code for fun. I had a project that I was working on, and I needed some sort of a programming language that would do calculations for me, and hopefully make managing a website easier. So I wrote my first web application.

Boy, was it bad.

(more…)

Friday, October 9th, 2009 @ 1:00 am | Comment (9) | Categories: Friday Inspirations, Technology
Tags: , ,

Accessing Databases with PDO: A Primer

With the introduction of PHP 5, the PHP Data Object was introduced as core functionality. PHP 5.1 turned on a minimum level of support for SQLite, by default, and PDO supports most of the major database engines. PDO offers a number of enhancements and improvements over the various database libraries (e.g. mysql_*, mysqli_*, pg_*), the biggest one being consistency. Still, the high level of code that involves direct use of the various database libraries means that PDO still isn’t as widely accepted as it should be.

This primer will show the various uses of PDO, and outline some of the benefits.

(more…)

Monday, October 5th, 2009 @ 1:00 am | Comment (4) | Categories: PHP 5, Best Practices, System Architecture
Tags: , ,

Configuring PHP: Essential INI Settings

When setting up a web server with PHP, there are a number of settings that are critical to consider. PHP 5.3 contains both a development INI file and a production INI file; however, users of older PHP releases (or those who don’t have direct control over their INI files) will want to pay attention and make sure that certain settings are configured.

These settings are the settings that I use whenever I configure a PHP server.

(more…)

Monday, September 28th, 2009 @ 1:00 am | Comment (16) | Categories: Best Practices, PHP 5, General PHP

Avoiding Notices: When to Use isset() and empty()

One of the most confusing things for new programmers (and it even trips me up sometimes) is how to test for boolean conditions in code. As developers, we want to develop code that never emits notices or warnings, and PHP gets a bit antsy when we develop code that utilizes uninitialized variables. Lucky for us, PHP makes it easy to test for these variables without getting these notices.

PHP (like most languages) evaluates a logical argument left to right. For an AND condition, both conditions have to be true; PHP stops evaluating if it finds any condition untrue; that means that we can use isset() or empty() as the first parameter in an if statement, and avoid raising notices.

(more…)

Wednesday, September 23rd, 2009 @ 1:00 am | Comment (13) | Categories: Best Practices, General PHP
Tags: ,

Newer Entries »

Copyright © 2023 by Brandon Savage. All rights reserved.