Currently i can create PDF files from images in Imagick with this function And it’s possible to fetch multiple pages with imagick like this But is it possible to save two image objects to two pages? (example of what i am thinking, its not possible like this) Answer I know this is long past due, but this…
Tag: php
Calling a function from a string in C#
I know in php you are able to make a call like: Is this possible in .Net? Answer Yes. You can use reflection. Something like this: With the above code, the method which is invoked must have access modifier public. If calling a non-public method, one needs to use the BindingFlags parameter, e.g. BindingFlags.N…
How can I unserialize session data to an arbitrary variable in PHP?
I want to unserialize a session_encode()’d string of session data to my own array (i.e. not to $_SESSION.) There doesn’t appear to be an in-built function that handles this. There’s session_decode() but it writes directly to the $_SESSION super-global. There’s unserialize() but it retu…
How can I get stock quotes using Google Finance API?
I’m looking for access to financial data from Google services. I found this URL that gets the stock data for Microsoft. What are all the possible parameters that Google allows for this kind of HTTP request? I’d like to see all the different information that I could get. Answer There’s a whol…
Checking to see if one array’s elements are in another array in PHP
I have two arrays in PHP as follows: People: Array ( [0] => 3 [1] => 20 ) Wanted Criminals: Array ( [0] => 2 [1] => 4 [2] => 8 [3] => 11 [4] => 12 …
Detect file encoding in PHP
I have a script which combines a number of files into one, and it breaks when one of the files has UTF8 encoding. I figure that I should be using the utf8_decode() function when reading the files, but I don’t know how to tell which need decoding. My code is basically: Currently, at the start of a UTF8 f…
Are php strings immutable?
Or: Should I optimize my string-operations in PHP? I tried to ask PHP’s manual about it, but I didn’t get any hints to anything. Answer PHP already optimises it – variables are assigned using copy-on-write, and objects are passed by reference. In PHP 4 it doesn’t, but nobody should be …
Zend Framework Routing: .html extension
I know I’ve seen this done before but I can’t find the information anywhere. I need to be able to route with .html extensions in the Zend Framework. I.E. /controller/action.html should route to the …
Application access server load
I have developed an application in PHP + JavaScript. I’m using MySQL as database support. Every account for this app will come with a subdomain… so the client Stardust would have stardust.mysite.com. I want to put the application files in a folder outside public_html and link every account from ev…
Sorting an array of arrays by the child array’s length?
What’s the best way in PHP to sort an array of arrays based on array length? e.g. Answer This will work: Note that this function will preserve the numerical keys. If you want to reset the keys, wrap it in a call to array_values().