Archive for the 'PHP bits' Category

PHP #3

05May07

Performance Issues
Depending on the scale of your application, there are some performances issues you might need to consider when using references.
In simple cases of copying one variable to another PHP’s internal reference counting feature prevents unneccessary memory usage.
E.g
$a = ‘the quick brown fox’;
$b = $a;
The above example, the value of $b would not take up [...]


PHP Post #2

24Apr07

Heredoc syntax, an alternative to writing PHP strings.
You begin with <<<EOD and a new line, and end it with a new line and then EOD.
$page .= <<<EOD
<p align=”center” >example</p>la
EOD;
Writing your first PHP class
<? php
//page class
class Page {
function doThis( ) { }
function doThat( ) { }
}
//end class
//Initialize the Page variable
$page = ” ;
$page = Page::doThis( );
$page [...]


PHP Post #1

23Apr07

Including one PHP script in another

PHP provides four commands that allow you to add the contents of one PHP script to another, namely include, require, include_onc, and require_once. In each case, PHP fetches the file named in the command, then executes the contents. The difference between include and require is the way they behave should [...]