It is simple enough to check and then load the number of available processing cores on the current machine into a PHP variable. You can do so with the code below, which uses shell commands to grab data from /proc/cpuinfo and then removes unneeded data with PHP.
/*How to check how many processors are available on the current machine.
by email@example.com http://www.Incero.com. Feel free to use this code,
but keep this header. June 30th, 2010.*/
$numberOfProcessors=`cat /proc/cpuinfo | grep processor | tail -1`;
echo "Number of processors on this machine is $numberOfProcessors!";
We use this code to help our programs assign the most efficient parameters to others processes, such as FFMpeg video conversions, that we spawn from PHP across various machines.
Tested on CentOS 5.4, should work on most Linux distributions.