To read an extension from a X.509 certificate, you can proceed like this if you know the OID
//Read the certificate from file
$cert = file_get_contents('test.crt');
$ssl = openssl_x509_parse($cert);
$ext_value = $ssl['extensions']['1.2.3.4.5.6'];
echo $ext_value
--------------------------------
Because the $ssl array is not documented, you can easily see its contents like this:
//To print out all the array!
print_r(array_values($ssl));
print_r(array_keys($ssl));