PHP Dump/Debug script.

Ever use PHP’s var_dump() or print_r() to debug what is going wrong with that $data you have ?

Well, this simple script acts as the above functions, yours first parameter is your data, and the second optional parameter is stoping the script or continuing on.

The ‘debug_backtrace()’ function will return which file call’s the dump function so you can easily track where your errors are coming from.

	function dump($data = array(), $finish = TRUE) {

		list($referrer) = debug_backtrace();
		$total = count($data);
		echo '
'; echo ''.$referrer['file'].' @ line: '.$referrer['line'].''; echo '
		$l = 0;
		if($data) {
			foreach($data as $line => $value) {
		        echo '
Debug #'.(++$l).' of '.$total.', Line: #'. $line .':
'; print_r($value); } } echo "

echo "

if($finish == TRUE) die;


Force Eject a CD/DVD in Apple Leopard

Today I had to help a friend force eject a stuck DVD in his iBook, there are a couple of methods we tried and I thought that hey may be helpful for others.

I would recommend trying to eject your stuck CD/DVD in this order;

1) Hold the ‘Eject’ Key for up to 30 seconds.

2) Stop the CD/DVD spinning

Stop the CD/DVD from spinning by gentle pushing in a thin piece of cardboard ( not to soft, nor hard ), thin packaging cardboard from like a battery or toy packet.
This will stop the CD as it is always spinning slightly, then hold the EJECT key for 8-10 seconds.

3) Restart holding the Mouse Button

Restart your mac, and once the machine chimes, hold the mouse button down ( external mouse or trackpad button ). This should eject the DV/DVD in up to 8 seconds.
If not, restart your mac again.

4) Restart in to Single User Mode

Restart your machine, and hold down the ‘Command ( apple )‘ + ‘O ( o for orange )‘ + ‘F ( f for fred )‘ keys.
This will boot you in to single user mode.

Type the following Command:

eject cd

Then press the ‘enter’ key

This should eject the CD/DVD.

Once the CD is ejected, type;


Then press the ‘enter’ key to boot back in to your Mac OS.

Force Eject a CD/DVD in Apple Leopard
Force Eject a CD/DVD in Apple Leopard