Here is the code I am using to run through the loop and return the values
foreach ($matches[0] as $certs) {
$x509 = new File_X509();
$chain = $x509->loadX509($certs);
$ICN = $x509->getIssuerDNProp('CN');
print_r($ICN);
}
I am using an external library to parse $certs and finally end up with $ICN which has the final value i am interested in. However, each value is in its own array, I would like to merge them together into one array.
Here is the current output for $print_r($ICN):
Array
(
[0] => thawte DV SSL CA - G2
)
Array
(
[0] => thawte Primary Root CA
)
Array
(
[0] => Thawte Premium Server CA
)
Here is the desired output:
Array
(
[0] => thawte DV SSL CA - G2
[1] => thawte Primary Root CA
[2] => Thawte Premium Server CA
)
-- ATTEMPT --
Using the following code offered by @zeflex
$finalArray = array();
foreach ($matches[0] as $certs) {
$x509 = new File_X509();
$chain = $x509->loadX509($certs);
$ICN = $x509->getIssuerDNProp('CN');
$finalArray[] = $ICN[0];
}
print_r($finalArray);
Resulted in this output - as you can see, only the last value is in the array - the first two not included for some reason??
Array
(
[0] => Thawte Premium Server CA
)
getIssuerDNProp()returns one or more elements, you can spread those while pushing so that you get a flat result array.array_push($finalArray, ...$x509->getIssuerDNProp('CN'));