If you have a value and SI unit - for example 2000W - and you want to display this in engineering notation - 2kW - then this may help.

/**
* Format a float in engineering notation
* @value float floating point number
* @units string like W for Watt
* @return array
*/
function Eng ($value, $units) {

    // Exceptions
    if (is_null($value)) {
        return array(
            'value' => NULL,
            'units' => $units,
            'decimals' => 0,
        );
    }
    if ($value == 0) {
        return array(
            'value' => 0,
            'units' => $units,
            'decimals' => 2,
        );
    }
    if (abs($value) < 0.00001) {
        return array(
            'value' => 0,
            'units' => $units,
            'decimals' => 2,
        );
    }

    // Process
    $eng = 0;
    while (abs($value) > 1000) {
        $eng++;
        $value = $value / 1000;
    }
    while (abs($value) < 1) {
        $eng--;
        $value = $value * 1000;
    }

    // Rounding for three significant figures
    if (abs($value) < 10) {
        $decimals = 2;
    }
    else if (abs($value) < 100) {
        $decimals = 1;
    }
    else {
        $decimals = 0;
    }
    $value = number_format($value, $decimals);

    // Prefix
    $prefix = array(
        -4 => 'p',
        -3 => 'n',
        -2 => 'u',
        -1 => 'm',
        0 => '',
        1 => 'k',
        2 => 'M',
        3 => 'G',
        4 => 'T',
        5 => 'P',
    );
    $units = $prefix[$eng] . $units;

    return array(
        'value' => $value,
        'units' => $units,
        'decimals' => $decimals,
        );

}

usage is

$value = 2000;
$units = 'W';
$result = Eng($value, $units);
echo $result['value'] . $result['units'];

gives 2kW

This is an updated version of the code.