A
A
Anton2020-04-27 18:35:11
PHP
Anton, 2020-04-27 18:35:11

How to display the value?

spoiler
use CdekSDK\Requests;

$request = new Requests\RegionsRequest();
$request->setPage(0)->setSize(100);
$request->setCountryCode('RU');
$request->setregionCodeExt('62');

$response = $client->sendRegionsRequest($request);
echo '<pre>';
print_r($response);
echo  '</pre>';

Outputs:
spoiler
CdekSDK\Responses\RegionsResponse Object
(
[items:CdekSDK\Responses\RegionsResponse:private] => Array
(
[0] => CdekSDK\Common\Region Object
(
[regionUuid:CdekSDK\Common\Region:private] => 9b62edf1-0f1a-4807-add2-585ef6e16feb
[regionName:CdekSDK\Common\Region:private] => Рязанская
[prefix:CdekSDK\Common\Region:private] => область
[regionCode:CdekSDK\Common\Region:private] => 41
[regionCodeExt:CdekSDK\Common\Region:private] => 62
[regionFiasGuid:CdekSDK\Common\Region:private] => 963073ee-4dfc-48bd-9a70-d2dfc6bd1f31
[countryName:CdekSDK\Common\Region:private] => Россия
[countryCode:CdekSDK\Common\Region:private] => RU
[countryCodeExt:CdekSDK\Common\Region:private] => 643
)

)

)

How to display simply in print 41 from a line[regionCode:CdekSDK\Common\Region:private] => 41

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2020-04-27
@anton99zel

As you can see for yourself, regionCode is a private property. You cannot directly pull it out. You need to use some public method. See here what suits you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question