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:
$input = array(1, 2, 2, 3, 3, 4);
$result = array_unique($input);
Remember: Output of array_unique() will have the same key of input array.
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 a number of other improvements:
- the ability to select which editions have images for offline reading
- instant online sync
- translation for 38 languages
- promised 7X performance boost
And the best – app is completely free, and adapts the layout to suit both phones and tablets.
Scan QR code below to download it for the platform of your choice.
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:
<show name="The Simpsons">
I found quick but little dirty way to do convert such axml document to an array, using type casting and JSON functions. After this i can ensure there are no exotic values that would cause problems when unserializing:
$a = json_decode(json_encode((array) simplexml_load_string($tv)),1);
After this we get:
[show] => Array
[@attributes] => Array
[kid] => Array
 => Bart
 => Lisa