My script store data in a variable like this:
$dados = curl_exec($curl);
$dados = simplexml_load_string($dados);
and return this object:
object(SimpleXMLElement)[1]
public 'cServico' =>
object(SimpleXMLElement)[2]
public 'Codigo' => string '40010' (length=5)
public 'Valor' => string '28,35' (length=5)
public 'PrazoEntrega' => string '1' (length=1)
public 'ValorSemAdicionais' => string '26,10' (length=5)
public 'ValorMaoPropria' => string '0,00' (length=4)
public 'ValorAvisoRecebimento' => string '0,00' (length=4)
public 'ValorValorDeclarado' => string '2,25' (length=4)
public 'EntregaDomiciliar' => string 'S' (length=1)
public 'EntregaSabado' => string 'S' (length=1)
public 'Erro' => string '0' (length=1)
public 'MsgErro' =>
object(SimpleXMLElement)[3]
How can I store "valor" value in a variable without using a loop?
I try this with no sucess:
$foo = $dados[0]->cServico->valor;