php

Latest information on PHP upcoming releases

I'm trying to track the progress of PHP 5.3 and PHP 6 and I occassionally see blogs posting information but there doesn't seem to be an authoritative source. Does anybody know where there is an official summary of possible new features? EDIT: There are some meeting notes that have been around for years... as far as I can tell this meet...

Best way to allow plugins for a PHP application

I am starting a new web application in PHP and I this time around I want to create something that people can extend by using a plug-in interface. I am a very confident PHP developer however I have never done this before so I'm not really sure where to start. How does one go about writing 'hooks' into their code so that plug-ins can att...

Flat File Databases in PHP

What are your best practices around creating flat file database structures in PHP? A lot of the more mature PHP flat file frameworks I see out there attempt to implement SQL-like query syntax, which is over the top for my purposes in most cases (I would just use a database at that point). Are there any elegant tricks out there to get g...

How would you access Object properties from within an object method?

What is the "purist" or "correct" way to access an object's properties from within an object method that is not a getter/setter method? I know that from outside of the object you should use a getter/setter, but from within would you just do: Java: String property = this.property; PHP: $property = $this->property; or would you do:...

How do I track file downloads with apache/PHP

I have a website that plays mp3's in a flash player. If a user clicks 'play' the flash player automatically downloads an mp3 and starts playing it. Is there an easy way to track how many times a particular song clip (or any binary file) is downloaded?...

Apache/PHP: error_log per Virtual Host?

On one Linux Server running Apache and PHP 5, we got multiple Virtual Hosts with separate logfiles and everything. The only thing we cannot seem to separate between virtual hosts is the php error_log. Overriding this setting in the <Location> of the httpd.conf does not seem to do anything. Did I overlook something? Is there a way to hav...

What's the best way to generate a tag cloud from an array? (using h1 through h6 for sizing)

Lets say i have an array like such $artist = array("the roots","michael jackson","billy idol","more","and more","and_YET_MORE"); $count = array(5,3,9,1,1,3); and i want to generate a tag clound that will have artist with a higher number in count be a H6 tag and the lowest being H1? any ideas? ...

How do I access a remote form in php?

I want to gather info from a user on a local php page (that I control), and use that info to query a form on another site (that I don't control) - how do I do that?...

PHP Session Security

What are some guidelines for maintaining responsible session security with PHP? There's information all over the web, so it's about time it all landed in one place!...

Best way to access Exchange using PHP?

I'm writing a CMS application in PHP and one of the requirements is that it must be able to interface with the customer's Exchange server. I've written up this functionality a few times before and have always used WebDAV to do it, but now I'm leaning away from that. I will be running the site on IIS OR Apache (no preference) on Windows...

Connect PHP to an AS/400

I've got an upcoming project wherein I will need to connect our website (PHP5/Apache 1.3/OpenBSD 4.1) to our back-end system running on a iSeries with OS400 V5R3 so that I can access some tables stored there. I've done some checking around but am running into some roadblocks. From what I've seen the DB2 extensions and DB2 software from ...

Best way to implement unit testing in PHP

I'd really like to start implementing Unit Testing in my projects. I don't know how viable this is to do in PHP. If anyone has done this, how was it implemented? Did it increase productivity? ...

PHP Variables passed by value or by reference?

I had a Java developer new to PHP ask me this question the other day, so I thought I'd document the answer here. Question: are PHP variables passed by value or by reference?...

How do you debug PHP scripts?

How do you debug your PHP script? I am aware of basic debugging such as using the Error Reporting. The breakpoint debugging in PHPEclipse is also quite useful. Any other good/better techniques out there?...

Make XAMPP/Apache serve file outside of htdocs

Is it possible to configure xampp to serve up a file outside of the htdocs directory? For instance, say I have a file: C:\projects\transitCalculator\trunk\TransitCalculator.php and my xampp files are normally served out of: C:\xampp\htdocs\ (because that's how it's configured by default) Is there some way to make Apache recognize an...

How can I get the authenticated user name under Apache using plain HTTP authentication and PHP?

First, let's get the security considerations out of the way. I'm using simple authentication under Apache for a one-off, internal use only, non-internet connected lan, php web app. How can get I the HTTP authenticated user name in PHP?...

Using object property as default for method property

I'm trying to do this (which produces an unexpected T_VARIABLE error): public function createShipment($startZip, $endZip, $weight = $this->getDefaultWeight()){} I don't want to put a magic number in there for weight, since the object I am using has a "defaultWeight" parameter that all new shipments get if you don't specify a weight. I ...

Wordpress theme development offline tools

Are there any offline tools available for Wordpress theme development other than Dreamweaver extentions? I'm looking for something that renders a page in a Gecko (or related widget) window in response to my editing of the theme code so I don't need keep editing files on a web server. Any ideas? EDIT: Should have been more clear. I ha...

Mechanisms for tracking DB schema changes

What are the best methods for tracking and/or automating DB schema changes? Our team uses Subversion for version control and we've been able to automate some of our tasks this way (pushing builds up to a staging server, deploying tested code to a production server) but we're still doing database updates manually. I would like to find o...

How can I get at the matches when using preg_replace in PHP?

I am trying to grab the capital letters of a couple of words and wrap them in spans. I am using preg_replace, but it's not outputting anything. preg_replace("/[A-Z]/", "<span class=\"initial\">$1</span>", $str)...