how to get the root category ids from Magento

<?php
/**
 * Get Magento root category ids
 */

date_default_timezone_set("Europe/London");

require './app/Mage.php';
Mage::app('admin')->setUseSessionInUrl(false);
Mage::getConfig()->init();


$category = Mage::getModel('catalog/category');
$tree = $category->getTreeModel();
$tree->load();

$ids = $tree->getCollection()->getAllIds();
$categories = array();
$rootCategories=array();
if (isset($ids)) {
    foreach ($ids as $id) {
        $category->load($id);
        $categories[$id]['name'] = $category->getName();

yii how to get table name

Create a rawTableName method in the model like this:

	/**
	 * @return string the associated database raw table name
	 */
	public function rawTableName($full = true) {
		return $full?str_replace('`', '', $this->tableSchema->rawName) : preg_replace('#[^a-z_]#i','',$this->tableName());
	}

And in the view you can use this:

<?php
print 'Model table name: '.$model->rawTableName(false);
?>

or

<?php
print 'Model table name: '.$model->rawTableName();
?>

php shorthand operators coding techniques and examples

This techniques and examples come in handy anytime for any coder and as soon as you start using them you already start to save time too.

Conditional and action:

<?php
$a && print $a; // outputs $a if $a is true

Initiate an object from an array:

<?php
$object = (object) array ('user1' => 'Franz', 'superuser' => 'ZeusCool');
echo $object->superuser; // prints out ZeusCool

Example of a shopping cart implementation of shorthand operator: