PHP

From WhyNotWiki
Jump to: navigation, search

Contents

Reference links

Arrays

http://www.bram.us/2007/11/19/my-incfunctionsphp-part-4-unshifting-elements-on-an-array-and-preserving-keys/. Retrieved on 2007-05-11 11:18.

The solution is to create a second array with only one item (index: “0”, value: “Please choose a city” and then merge them together, but not using the array_merge function as the function looses numerical keys too! So what does one need to use then? Well, it might sound noobcake-ish to you but this one I didn't know: one can actually join 2 arrays in PHP by using the mathematical + operator!


Conventions

is_null($x) or isset($x) or $x=== null or $x== null or just plain $x ??

Exceptions (PHP 5)

http://wiki.ciaweb.net/yawiki/?area=PEAR_Dev&page=RfcExceptionUse

http://devzone.zend.com/node/view/id/666 Zend Developer Zone | Exceptional Code - PART 1

Notes/Snippets

Timezones

<?php
echo date_default_timezone_get() . "\n";
echo date('m/d/Y g:i A e', time()) . "\n";

date_default_timezone_set('US/Eastern');

echo date_default_timezone_get() . "\n";
echo date('m/d/Y g:i A e', time()) . "\n";
?>

America/Los_Angeles
08/24/2006 1:27 PM America/Los_Angeles
US/Eastern
08/24/2006 4:27 PM US/Eastern

Unit testing

http://www.lastcraft.com/simple_test.php

Templating frameworks/languages

http://www.megginson.com/blogs/quoderat/2005/06/11/rails-vs-php-mvc-or-view-centric/. Retrieved on 2007-05-11 11:18.

Smarty is a behemoth, but since PHP is itself a template language, all you really need is something to separate out your view logic. Savant (http://phpsavant.com/) is great for this, and it uses PHP itself as the template language, so it’s lightweight and very fast.

[Security (category)]

http://dev.joomla.org/component/option,com_jd-wiki/Itemid,31/id,tips:make_secure/ star_full.gif star_full.gif star_full.gif star_full.gif star_empty.gif

Retrieved from "http://whynotwiki.com/PHP"
Ads
Personal tools