setcooki
ALLROUND WEB DEVELOPER

28
Sep 11

PHP DOM XML to Array

What is the fastest way to parse a XML string into a equivalent valid Array representation?

I have seen quite some efforts on different blogs and the comments on php.net in some of the functions suggest some valid approaches. The problem with most approaches though, i find, is the lack of xml testing before passing it to the function to transform the xml to array. When you want to make sure you have a valid XML string the PHP DOMDocument class and its sub classes provide everything for iteration through its childs, to saving string presentations to file and so on. On top DOM perfectly validates XML strings when passed into the loading methods of the class. Also i believe any approach using DOM rather then handling the XML string with regex or whatever should be much faster and safer to rely on.
More…

10
Sep 11

PHP & Ghostscript – Count pages of PDF

Count pages of a pdf is pretty simple!

One way of finding out how to count the pages of a PDF file with PHP apart from imagemagick which always performance very slow and shaky (depends on the version) is to use the Linux Ghostscript library via shell and PHPs exec() commands. More…


Copyright © 2012 setcooki
Proudly powered by WordPress, Free WordPress Themes