November PHP-Scripts Blog Archives

Giving readers multiple RSS reader subscription options

It’s cool that there are so many different RSS readers out there from a reader perspective because people get to choose which solution works best for them but the downside for publishers is how to make it easy for the many different RSS Readers to subscribe. You can put in the head of the document […]

PHP 5.1.0 now available

PHP 5.1.0 has been released on Thanksgiving. Changelog

pathinfo

Let’s say you have a long URL or file and want to access different parts. PHP has a built-in function called pathinfo() that may be of assistance. Let’s look at a couple examples.
File path
$file_path = ‘/usr/web/tdavid/php-scripts.com/main/index.html’;
URL
$url_path = ‘http://www.php-scripts.com/main/index.html’;
Now let’s dump this into a script and see the output:

<?php
//File path
$file_path = pathinfo(‘/usr/web/tdavid/php-scripts.com/main/index.html’);
//URL
$url_path = pathinfo(‘http://www.php-scripts.com/main/index.html’);
print ‘dirname: ‘ […]

Detecting and filtering patterns

I’ve been noticing a pattern in the comment spam being received on a couple of our blogs. See the following comment:

A couple things I noticed about the pattern:
- comment spam frequently comes from blogspot.com
- starts with hyperlink and then contains a sentence or two of text, usually nonsense
Let’s write some code to filter any HTML […]

Installing Apache, PHP, MySQL on Windows XP

Didn’t try these tutorials out, but they look pretty thorough and thought I’d pass them along:
These are how-to tutorials to give step by step instructions for installing, setting up, and configuring Apache2 web server, ActivePerl, PHP, and MySQL in Windows. A section is also included that tells you how to make your server accessible to […]

Making multiple form output look better

You don’t have to know a ton of Cascading Style Sheet (CSS )to make forms look nicer on a web page. Let’s take a recent simple script I created. It’s a simple auction display script written in PHP. The version without any styling is shown below:

Notice the forms look pretty plain. We can add styling […]

The importance of ongoing learning

Normally I save the philosophical stuff for other blogs (and promise not to do too much of this here), but this morning an important topic came up in the #scriptschool chat (irc.scriptschool.com #scriptschool) related to PHP: ongoing learning.
I’m a huge proponent of ongoing learning. It’s important not just to learn something but to use […]

ASCII character codes

If you need to print out special characters in PHP you will probably want to get familiar with the built-in chr() function. Here’s some code that will demonstrate the various ASCII character codes available and how to output them to the screen:

<?php
print ‘Copyright (169): ‘ . chr(169);
print ‘<br />Registered Trademark (174): ‘ . chr(174);
print ‘<br […]

symfony open source php5 framework

Based on the concept of Rails / Django like framework only for PHP, here comes the MIT licensed symfony

Using file_get_contents before v4.3.0

One of the dangers of using newer PHP functions is that sometimes you’ll end up with people who are stuck on a shared host using an older version of PHP. In this case it’s helpful to have some backwards compatible functions. The category backwards compatability will deal with these situations.
file_get_contents has only been available in […]