The code below can be used to get PI's value from an XML document
<?php
$my_xml_data =
'<?xml version="1.0" encoding="UTF-8"?>
<student>
<?sort alpha-ascending?>
<?textinfo whitespace is allowed ?>
<first-name>George</first-name>
<phone.mobile>(011) 123-4567</phone.mobile>
</student>';
$xml = simplexml_load_string($my_xml_data);
$doc = dom_import_simplexml($xml)->ownerDocument;
$xpath = new DOMXPath($doc);
# prints "/* processing instructions */ ", the value of the first PI: textinfo
echo $xpath->evaluate('string(//processing-instruction("textinfo")[1])');
The output of the above code is the following:
whitespace is allowed