Here are a couple of questions: Is mail_queue->put supposed to insert a message twice in the database? The only differences are the time_to_send value and the user_id. This is what I get for a …
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 returns false on session_encode()’d strings as they’re a slightly different format. What’s the best way to do
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 whole API for managing portfolios. *Link removed. Google no
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 file, it
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 using PHP 4 for new code anyway.
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 every subdomain created to this files folder through a config file
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().
What is the function __construct used for?
I have been noticing __construct a lot with classes. I did a little reading and surfing the web, but I couldn’t find an explanation I could understand. I am just beginning with OOP. I was wondering if someone could give me a general idea of what it is, and then a simple example of how it is used with PHP?