3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $pem = <<<PEM -----BEGIN CERTIFICATE----- MIIC+zCCAeOgAwIBAgIJAPKg9lX2H0oAMA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNV BAMMCWxvY2FsaG9zdDAeFw0xNTExMjUyMTQ2NTlaFw0xNTExMjgyMTQ2NTlaMBQx EjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC ggEBANd4B7T81h9sayA9peCJCW4KlL1GIUwoNZOwimZG7hLrY9POwXR4PpYeXZxO fdjso+8gVcWSJwXpbqWgzfMbe/m2c9iBa97KX5hOTxMRBdTkc+1WPBDUroEwJMpZ tR760DIWo/dTUV9zJcf//fqsaFw0trhLdIDKz4/A0+6KbkDf5HuJiAOwLHnAmgBe nsZeq+2gallUrc80AeaQr9P7TjXfUGw9tJ2fKEY/9lKxYLq6AxxzE574zxUu/O+c qF67YjB1fVfW2sjKA0r7JlXbjQX7TQHuhENbDDH5gjM5ZP247yJfUHzHljDrFugH tbGkzJqO83rUnkNk96xZbaLfLOkCAwEAAaNQME4wHQYDVR0OBBYEFM5UBEjdto77 fvR/b+BuB740bEmXMB8GA1UdIwQYMBaAFM5UBEjdto77fvR/b+BuB740bEmXMAwG A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAEaGXPN6B36ja1uhXq6Nd01A 3iVSbvgGwSjm1rVr1hVt3exdESivbn5l0N4HtCnQiisUcfzohavhNGQk5jpI0T12 366RJ8V7QUXt2HJMLs1YcnC+uNgHR2lmtj6eKLMPR/6cx1E8vo0tk2xaHE/5cruA dk31ylUxmsCiqJL3N1dybGYdMnboB2/NcCjtKWhSx9bvXiYc1Z+ZVha9+8CllqRb p5EtUYMV0hsXPZyDipeclhB1ROMrwcRa6y680O4NexJ0HD0NbiFcyincOswwTDbo SjXxYpdWHiKloGIa3qHN0MIas/lXqXDuR21zV7Yua2E0WRjKlCmoqVKvLHtqjVU= -----END CERTIFICATE----- PEM; $cert = @openssl_x509_read($pem); $info = openssl_x509_parse($cert); var_dump($info);
based on dpC3B
Output for 7.0.20, 7.1.5 - 7.2.0
array(16) { ["name"]=> string(13) "/CN=localhost" ["subject"]=> array(1) { ["CN"]=> string(9) "localhost" } ["hash"]=> string(8) "ce275665" ["issuer"]=> array(1) { ["CN"]=> string(9) "localhost" } ["version"]=> int(2) ["serialNumber"]=> string(20) "17483244602514164224" ["serialNumberHex"]=> string(16) "F2A0F655F61F4A00" ["validFrom"]=> string(13) "151125214659Z" ["validTo"]=> string(13) "151128214659Z" ["validFrom_time_t"]=> int(1448488019) ["validTo_time_t"]=> int(1448747219) ["signatureTypeSN"]=> string(10) "RSA-SHA256" ["signatureTypeLN"]=> string(23) "sha256WithRSAEncryption" ["signatureTypeNID"]=> int(668) ["purposes"]=> array(9) { [1]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(9) "sslclient" } [2]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(9) "sslserver" } [3]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(11) "nssslserver" } [4]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(9) "smimesign" } [5]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(12) "smimeencrypt" } [6]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(7) "crlsign" } [7]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(3) "any" } [8]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(10) "ocsphelper" } [9]=> array(3) { [0]=> bool(false) [1]=> bool(true) [2]=> string(13) "timestampsign" } } ["extensions"]=> array(3) { ["subjectKeyIdentifier"]=> string(59) "CE:54:04:48:DD:B6:8E:FB:7E:F4:7F:6F:E0:6E:07:BE:34:6C:49:97" ["authorityKeyIdentifier"]=> string(66) "keyid:CE:54:04:48:DD:B6:8E:FB:7E:F4:7F:6F:E0:6E:07:BE:34:6C:49:97 " ["basicConstraints"]=> string(7) "CA:TRUE" } }
Output for 5.5.24 - 7.0.6, 7.1.0
array(15) { ["name"]=> string(13) "/CN=localhost" ["subject"]=> array(1) { ["CN"]=> string(9) "localhost" } ["hash"]=> string(8) "ce275665" ["issuer"]=> array(1) { ["CN"]=> string(9) "localhost" } ["version"]=> int(2) ["serialNumber"]=> string(20) "17483244602514164224" ["validFrom"]=> string(13) "151125214659Z" ["validTo"]=> string(13) "151128214659Z" ["validFrom_time_t"]=> int(1448488019) ["validTo_time_t"]=> int(1448747219) ["signatureTypeSN"]=> string(10) "RSA-SHA256" ["signatureTypeLN"]=> string(23) "sha256WithRSAEncryption" ["signatureTypeNID"]=> int(668) ["purposes"]=> array(9) { [1]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(9) "sslclient" } [2]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(9) "sslserver" } [3]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(11) "nssslserver" } [4]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(9) "smimesign" } [5]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(12) "smimeencrypt" } [6]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(7) "crlsign" } [7]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(3) "any" } [8]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(10) "ocsphelper" } [9]=> array(3) { [0]=> bool(false) [1]=> bool(true) [2]=> string(13) "timestampsign" } } ["extensions"]=> array(3) { ["subjectKeyIdentifier"]=> string(59) "CE:54:04:48:DD:B6:8E:FB:7E:F4:7F:6F:E0:6E:07:BE:34:6C:49:97" ["authorityKeyIdentifier"]=> string(66) "keyid:CE:54:04:48:DD:B6:8E:FB:7E:F4:7F:6F:E0:6E:07:BE:34:6C:49:97 " ["basicConstraints"]=> string(7) "CA:TRUE" } }
Output for 5.4.15 - 5.4.45
array(12) { ["name"]=> string(13) "/CN=localhost" ["subject"]=> array(1) { ["CN"]=> string(9) "localhost" } ["hash"]=> string(8) "ce275665" ["issuer"]=> array(1) { ["CN"]=> string(9) "localhost" } ["version"]=> int(2) ["serialNumber"]=> string(20) "17483244602514164224" ["validFrom"]=> string(13) "151125214659Z" ["validTo"]=> string(13) "151128214659Z" ["validFrom_time_t"]=> int(1448488019) ["validTo_time_t"]=> int(1448747219) ["purposes"]=> array(9) { [1]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(9) "sslclient" } [2]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(9) "sslserver" } [3]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(11) "nssslserver" } [4]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(9) "smimesign" } [5]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(12) "smimeencrypt" } [6]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(7) "crlsign" } [7]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(3) "any" } [8]=> array(3) { [0]=> bool(true) [1]=> bool(true) [2]=> string(10) "ocsphelper" } [9]=> array(3) { [0]=> bool(false) [1]=> bool(true) [2]=> string(13) "timestampsign" } } ["extensions"]=> array(3) { ["subjectKeyIdentifier"]=> string(59) "CE:54:04:48:DD:B6:8E:FB:7E:F4:7F:6F:E0:6E:07:BE:34:6C:49:97" ["authorityKeyIdentifier"]=> string(66) "keyid:CE:54:04:48:DD:B6:8E:FB:7E:F4:7F:6F:E0:6E:07:BE:34:6C:49:97 " ["basicConstraints"]=> string(7) "CA:TRUE" } }
Output for 5.3.22 - 5.4.14

Process exited with code 255.