PHPRO.ORG

Have you ever sat in a boardroom, meeting, or had to wade through pages of specs only to find that a very small percentage of the information is actually useful, and the rest is utter bullshit. This simple function provides a method to measure exactly how much BS is contained in a string. The process is quite simple in that the length of the string is measured, and a percentage calculated from the total length of the BS in the bs array. Feel free to add you own bs words to the array.


<?php

/**
 *
 * Function to measure bs in a string
 *
 * @param    string     $string
 * @return    float
 *
 */
function bullshitMeter$string )
{
    
/*** example bs ***/
    
$bs = array (
        
'synergy',
        
'strategic fit',
        
'gap analysis',
        
'revisit',
        
'bandwidth',
        
'best practice',
        
'bottom line',
        
'hardball',
        
'out of the loop',
        
'benchmark',
        
'value added',
        
'proactive',
        
'win-win',
        
'think outside the box',
        
'fast track',
        
'result driven',
        
'empower',
        
'knowledge base',
        
'total quality',
        
'quality driven',
        
'touch base',
        
'mindset',
        
'client focus',
        
'ball park',
        
'game plan',
        
'independent it consultant',
        
'automatrix',
        
'leverage'
        
);

    
/*** make the string lower case for comparison ***/
    
$string strtolower$string );

    
/*** check the length of the string ***/
    
$text_count strlen$string );

    
/*** set bs count to zero ***/
    
$bs_count 0;
    foreach( 
$bs as $text )
    {
        if( 
$pos strpos($string$text ) )
        {
            
/*** get the number of occurances ***/
            
$occurances substr_count($string$text);

            
/*** get the lenth of the bs ***/
            
$bs_count += strlen$text ) * $occurances;
        }
    }

    
/*** do the percentage ***/
    
$percent = (int) $bs_count/ (int)$text_count 100;

    
/*** round to two places ***/
    
return round$percent);
}

?>

Example usage


<?php

/*** a string heavy in bs ***/
$string 'I bring your attention today to new benchmarks in quality driven development within the marketting sector. By adopting a proactive attitude to client relationships, we can develop a mindset with client focus as its central theme, while providing value added service guarentees that leverage new markets for us.';

$bs bullshitMeter$string );

echo 
"This string is $bs percent bullshit";

?>

Demonstration

This string is 22.58 percent bullshit