protected static function valueToOct($value)
    {
        $result = $value;

        // If the value is a string in a form '0777', then extract octal value
        if (is_string($value) && (strpos($value, '0') === 0)) {
            $value = intval($value, 8);
        }

        // If the value is not octal, convert
        if (decoct(octdec($value)) <> $value) {
            $result = base_convert((string) $value, 10, 8);
        }

        return $value;
    }
protected static function valueToOct($value)
    {
        $result = $value;

        // If the value is a string in a form '0777', then extract octal value
        if (is_string($value) && (strpos($value, '0') === 0)) {
            $value = intval($value, 8);
        }

        // If the value is not octal, convert
        if (decoct(octdec($value)) <> $value) {
            $result = base_convert((string) $value, 10, 8);
        }

        return $value;
    }
protected static function valueToOct ( $ value ) { $ result = $ value ; // If the value is a string in a form '0777', then extract octal value if ( is_string ( $ value ) && ( strpos ( $ value , '0' ) === 0 ) ) { $ value = intval ( $ value , 8 ) ; } // If the value is not octal, convert if ( decoct ( octdec ( $ value ) ) <> $ value ) { $ result = base_convert ( ( string ) $ value , 10 , 8 ) ; } return $ value ; }
Convert a given value to octal

Thanks to: http://stackoverflow.com/questions/13112934/ishex-and-isocta-functions

@param  string|numeric $value String, decimal integer, or octal value
@return numeric Octal value
Convert a given value to octal