$companies = $em->getRepository('AppBundle:Company')->findAll();
function articles_all() {
$art1 = ["id"=>1, "title"=>"Title1", "date"=>"12-10-2015", "content"=>"Content1"];
$art2 = ["id"=>2, "title"=>"Title2", "date"=>"13-10-2015", "content"=>"Content2"];
$arr[0] = $art1;
$arr[1] = $art2;
return $arr;
}
// PHP 5.4+
function articles_all() {
return [
['id' => 1, 'title' => 'Title1', 'date' => '12-10-2015', 'content' => 'Content1'],
['id' => 2, 'title' => 'Title2', 'date' => '13-10-2015', 'content' => 'Content2']
];
}
<?php
$xmlString = <<<'XML'
<?xml version="1.0" encoding="UTF-8" ?>
<tns:RequestAndResponse xmlns:tns="com.dtn.aghost.weather.weatherService">
<request>
<tns:Credentials>
<usernamePasswordCombo>
<username>E0E0E0</username>
<password>E0E0E0</password>
</usernamePasswordCombo>
</tns:Credentials>
</request>
<response>
<tns:AccountToken expires="2015-10-12T15:20:13.000Z">
<Token>E0E0E0E1E1E1</Token>
<URLEncodedToken>E0E0E0E1E1E1</URLEncodedToken>
</tns:AccountToken>
</response>
</tns:RequestAndResponse>
XML;
$xml = new SimpleXMLElement($xmlString);
foreach ($xml->xpath('//tns:Credentials') as $credentials) {
var_dump($credentials->usernamePasswordCombo->username, $credentials->usernamePasswordCombo->password);
}
foreach ($xml->xpath('//tns:AccountToken') as $token) {
var_dump($token->Token, $token->URLEncodedToken);
}