Skip to content

Instantly share code, notes, and snippets.

@bytefade
Last active April 13, 2016 13:31
Show Gist options
  • Save bytefade/1a1fbcf346d75c6a9d10545769ee9341 to your computer and use it in GitHub Desktop.
Save bytefade/1a1fbcf346d75c6a9d10545769ee9341 to your computer and use it in GitHub Desktop.
Foreach php array
<?php
$params = ['id' => 0];
try {
$api = new Gerencianet($options);
$subscription = $api->detailSubscription($params, []);
// var_dump($subscription); die;
foreach ($subscription as $value) {
// Array simples
echo $value['subscription_id'];
echo $value['value'];
echo $value['status'];
echo $value['custom_id'];
echo $value['notification_url'];
echo $value['payment_method'];
echo $value['next_execution'];
echo $value['next_expire_at'];
// Array bidimensional
echo $value['plan']['name'];
// Array bidimensional
echo $value['history'][0]['charge_id'];
echo $value['history'][0]['status'];
echo $value['history'][0]['created_at'];
}
die;
} catch (GerencianetException $e) {
print_r($e->code);
print_r($e->error);
print_r($e->errorDescription);
} catch (Exception $e) {
print_r($e->getMessage());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment