opensrs\Ops::PHP2XML PHP Метод

PHP2XML() публичный Метод

Converts a PHP array into an OPS data_block tag.
public PHP2XML ( $data ) : string
Результат string OPS data_block tag
    public function PHP2XML($data)
    {
        return str_repeat($this->_SPACER, 2) . '<data_block>' . $this->_convertData($data, 3) . $this->_CRLF . str_repeat($this->_SPACER, 2) . '</data_block>';
    }

Usage Example

Пример #1
0
 /**
  * should convert xml to php array.
  */
 public function testXml2Php()
 {
     $ops = new Ops();
     $data = array('convert' => 'this');
     // use our built in php to xml to test
     $result = $ops->PHP2XML($data);
     // converting back, they should be the same
     $this->assertSame($data, $ops->XML2PHP($result));
 }