<?php
$subscription = json_decode('{
"Subscription": {
"Id": 18849027,
"Subscriptionstatus": 1,
"NextBillingDate": "2018-07-08T15:31:08.654877",
"NextBillingDateReminder": "2018-07-01T15:31:08.654877Z",
"GracePeriodDays": 0,
"StartIntervalDayCount": 0,
"StartIntervalMonthCount": 1,
"IntervalDayCount": 0,
"IntervalMonthCount": 1,
"CustomerId": 73771655,
"CustomerReferenceId": "6kQ5CSMofkLdC0GQCn0EMgPzfAJ4ctN3F2JsAWQJ",
"CustomerCurrencyId": "EUR",
"CustomerReferenceNo": "",
"LastIntervalNo": 22,
"StartDate": "2016-08-08T15:31:08.654877",
"EndDate": null,
"Items": [
{
"SubscriptionId": 18849027,
"RunningNo": 1,
"Quantity": 1,
"ProductId": 82973,
"ProductName": "FastBill Complete",
"ProductNameExtension": "Monats-Abonnement",
"RecurrenceCount": null,
"Status": 1,
"DeactivationDate": null,
"StartDate": "2016-08-08T15:31:08.654877",
"EndDate": null,
"LastIntervalNo": 22,
"IsCurrent": true,
"Version": 1,
"Couponcode": "",
"PromotionId": null,
"SubscriptionPurchaseItems": [
{
"PurchaseId": 95742459,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 0
},
{
"PurchaseId": 97512712,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 1
},
{
"PurchaseId": 103064464,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 4
},
{
"PurchaseId": 108481281,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 7
},
{
"PurchaseId": 112016777,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 9
},
{
"PurchaseId": 113701986,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 10
},
{
"PurchaseId": 115302274,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 11
},
{
"PurchaseId": 117286219,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 12
},
{
"PurchaseId": 119449074,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 13
},
{
"PurchaseId": 123308459,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 15
},
{
"PurchaseId": 125233367,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 16
},
{
"PurchaseId": 127322800,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 17
},
{
"PurchaseId": 131151673,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 19
},
{
"PurchaseId": 132734325,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 20
},
{
"PurchaseId": 135749578,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 21
},
{
"PurchaseId": 138141409,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 22
},
{
"PurchaseId": 129265950,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 18
},
{
"PurchaseId": 99299879,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 2
},
{
"PurchaseId": 101140707,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 3
},
{
"PurchaseId": 104979919,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 5
},
{
"PurchaseId": 106823347,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 6
},
{
"PurchaseId": 110335886,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 8
},
{
"PurchaseId": 121485688,
"PurchaseItemRunningNo": 1,
"SubscriptionIntervalNo": 14
}
]
}
]
},
"ResultMessage": "OK"
}');
function cmp($a, $b) {
if ($a['SubscriptionIntervalNo'] == $b['SubscriptionIntervalNo']) {
return 0;
}
return ($a['SubscriptionIntervalNo'] < $b['SubscriptionIntervalNo']) ? -1 : 1;
}
print_r($subscription->Subscription->Items[0]->SubscriptionPurchaseItems);
print_r(usort($subscription->Subscription->Items[0]->SubscriptionPurchaseItems,"cmp"));
print_r($subscription);
Abusive script
This script was stopped while abusing our resources
- Output for 7.1.0 - 7.1.17, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.4 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.23, 8.3.0 - 8.3.11
- Array
(
[0] => stdClass Object
(
[PurchaseId] => 95742459
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 0
)
[1] => stdClass Object
(
[PurchaseId] => 97512712
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 1
)
[2] => stdClass Object
(
[PurchaseId] => 103064464
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 4
)
[3] => stdClass Object
(
[PurchaseId] => 108481281
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 7
)
[4] => stdClass Object
(
[PurchaseId] => 112016777
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 9
)
[5] => stdClass Object
(
[PurchaseId] => 113701986
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 10
)
[6] => stdClass Object
(
[PurchaseId] => 115302274
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 11
)
[7] => stdClass Object
(
[PurchaseId] => 117286219
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 12
)
[8] => stdClass Object
(
[PurchaseId] => 119449074
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 13
)
[9] => stdClass Object
(
[PurchaseId] => 123308459
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 15
)
[10] => stdClass Object
(
[PurchaseId] => 125233367
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 16
)
[11] => stdClass Object
(
[PurchaseId] => 127322800
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 17
)
[12] => stdClass Object
(
[PurchaseId] => 131151673
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 19
)
[13] => stdClass Object
(
[PurchaseId] => 132734325
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 20
)
[14] => stdClass Object
(
[PurchaseId] => 135749578
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 21
)
[15] => stdClass Object
(
[PurchaseId] => 138141409
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 22
)
[16] => stdClass Object
(
[PurchaseId] => 129265950
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 18
)
[17] => stdClass Object
(
[PurchaseId] => 99299879
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 2
)
[18] => stdClass Object
(
[PurchaseId] => 101140707
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 3
)
[19] => stdClass Object
(
[PurchaseId] => 104979919
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 5
)
[20] => stdClass Object
(
[PurchaseId] => 106823347
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 6
)
[21] => stdClass Object
(
[PurchaseId] => 110335886
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 8
)
[22] => stdClass Object
(
[PurchaseId] => 121485688
[PurchaseItemRunningNo] => 1
[SubscriptionIntervalNo] => 14
)
)
Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/ij8ls:163
Stack trace:
#0 [internal function]: cmp(Object(stdClass), Object(stdClass))
#1 /in/ij8ls(169): usort(Array, 'cmp')
#2 {main}
thrown in /in/ij8ls on line 163
Process exited with code 255.
preferences:
65.72 ms | 423 KiB | 5 Q