Archive for balandžio, 2012

Remove duplicate values from an array in PHP

balandžio 23rd, 2012

Today’s chalenge: How to remove the duplicate values from a PHP array? after short search i found solution array_unique. How this function works: <?php $input = array(1, 2, 2, 3, 3, 4); $result = array_unique($input); var_dump($result); ?> will output: array(4) { [0]=> int(1) [1]=> int(2) [3]=> int(3) [5]=> int(4) } Remember: Output of array_unique() will […]

Google Currents app updated !

balandžio 19th, 2012

US people have been able to use the Google Currents app to read various websites with magazine-style layout. Now other countries can finally get in on the act as well. Google has release version 1.1 of the app for Android and iOS. New version makes the service available worldwide with support for 44 languages, adds […]

XML to PHP array

balandžio 10th, 2012

Some times when working in PHP you need a way to convert an XML document into a serializable array. If you ever tried to serialize() and then unserialize() a SimpleXML or DOMDocument object, you know what I’m talking about. Assume the following XML snippet: <tv> <show name=“The Simpsons“> <husband>Homer</husband> <wife>Marge</wife> <kid>Bart</kid> <kid>Lisa</kid> <kid>Maggie</kid> </show> </tv> […]