Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @var PDO
- */
- $array = [
- 45 => [
- 'curl_options' => [
- CURLOPT_URL => 'http:',
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_POST => true,
- ],
- 'curl_postfield' => 'id',
- 'status_pattern' => '/[da-z]{13}s*(.+)/isu'
- ],
- 46 => [
- 'curl_options' => [
- CURLOPT_URL => 'http:',
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_POST => true,
- ],
- 'curl_postfield' => 'post',
- 'status_pattern' => '/[da-z]{10}s*(.+)/isu'
- ]
- ];
- $array = [];
- /** @var $array ExampleClass[] */
- foreach ($array as $object) {
- // $object->getS... сработает автодополнение
- $object->getSomething();
- }
- class ExampleClass
- {
- /** @var ExampleEmbeddedClass[] */
- public $list = [];
- public function getSomething() {}
- }
- class ExampleEmbeddedClass
- {
- public $property = 1;
- }
- $array = [
- 42 => new ExampleClass(),
- ];
- /** @var $array ExampleClass[] */
- $array[42]->list[] = new ExampleEmbeddedClass();
- $cleanArray = json_decode(json_encode($array), true);
- var_export($cleanArray);
- array (
- 42 =>
- array (
- 'list' =>
- array (
- 0 =>
- array (
- 'property' => 1,
- ),
- ),
- ),
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement