jump to navigation

How to beautifully retrieve arrays in PHP? February 29, 2008

Posted by ordinarywebguy in PHP.
2 comments

How?

Cast it to object type. :D

See example:

$info = array(
‘first_name’ => ‘Mitch Khenly’,
‘last_name’ => ‘Pascual’,
‘age’ => 1
);

$info = (object) $info; # the secret :)

You can now access it like this:

$info->first_name;
$info->last_name;
$info->age;

I find and see it more beautiful to retrieve / access arrays that way. It’s more readable. Agree? :)

Head First E-books February 14, 2008

Posted by ordinarywebguy in Books, Design Patterns, E-books, Head First, JSP, Java, OOP.
3 comments

I frustratingly wished and wanted to have a copy of these books … but these e-books make my wish come true.

Head First Java, 2nd Edition
Head First Design Patterns
Head First Servlets and JSP: Passing the Sun Certified Web Component Developer Exam (SCWCD)

and…

more here.

Got to print them out soon… Hehe!