I’m trying to connect to Gmail through IMAP with PHP running in Apache. This is on an Ubuntu 9.04 system. I’ve got some sort of PHP configuration issue that is keeping this from working. First, …
Category: Questions
How do I find out the currently running PHP executable?
From inside a PHP program I want to know the location of the binary executing it. Perl has $^X for this purpose. Is there an equivalent in PHP? This is so it can execute a child PHP process using itself (rather than hard code a path or assume “php” is correct). UPDATE I’m using lighttpd + FastCGI, not Apache +
php – check for valid guid
I have a mssql database in which my primary keys are GUIDs. I am working on a web interface for inserting some data. I need a GUID, generated by php. I am using com_create_guid() function. So, before …
How can I alternate between mysqli_real_escape_string and nl?
I’ve been doing some reading on mysqli_real_escape_string(), and, after getting my content properly escaped, I’m having some trouble getting to display properly when I pull it out again. Here’s the …
C# String.Format() Equivalent in PHP?
I’m building a rather large Lucene.NET search expression. Is there a best practices way to do the string replacement in PHP? It doesn’t have to be this way, but I’m hoping for something similar to the C# String.Format method. Here’s what the logic would look like in C#. Is there a PHP5 equivalent? Answer You could use the sprintf function:
Unable to call the built in mb_internal_encoding method?
I’m trying to install indefero on a CentOS 5.3 VMware ‘box’ and I ran into a problem. Quite early in the installation I get an error that I’ve been able to narrow down to this: I get the same error when calling this script via http through Apache. Now according to the PHP manual the mb_internal_encoding function should be a
How to search Array for multiple values in PHP?
I need to get the keys from values that are duplicates. I tried to use array_search and that worked fine, BUT I only got the first value as a hit. I need to get both keys from the duplicate values, in this case 0 and 2. The search result output as an array would be good. Is there a PHP
Find greatest of three values in PHP
With three numbers, $x, $y, and $z, I use the following code to find the greatest and place it in $c. Is there a more efficient way to do this? Answer Probably the easiest way is $c = max($x, $y, $z). See the documentation on maxDocs for more information, it compares by the integer value of each parameter but will
PHP Getting Domain Name From Subdomain
I need to write a function to parse variables which contain domain names. It’s best I explain this with an example, the variable could contain any of these things: here.example.com example.com …
How to modify xml file using PHP
I want to modify my xml file in PHP based on the following criteria. my xml structure look like this: Now every time when xml going to modify, with the type attribute. means, on first time search string == “hotels” then data related to hotels will be stored in xml file as above format. Now when again search for hotels