Skip to content
Advertisement

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 …

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

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

Advertisement