Skip to content

Instantly share code, notes, and snippets.

@dilantha
Last active August 29, 2015 14:05
Show Gist options
  • Save dilantha/470b28f9e58192b5cd27 to your computer and use it in GitHub Desktop.
Save dilantha/470b28f9e58192b5cd27 to your computer and use it in GitHub Desktop.
Coder maturity
<?php
// 2006
if ($payment_type != null) {
if ($payment_type == 'cash') {
if ($balance > 0) {
$status = 'credit';
} else if ($balance == 0) {
$status = 'cash';
}
} else if ($payment_type == 'cheque') {
if ($balance > 0) {
$status = 'credit';
} else if ($balance == 0) {
$status = 'cheque';
}
} else {
$status = $payment_type;
}
} else {
$status = 'pending';
}
// 2014
$status = 'pending';
if(in_array($payment_type, array('cash', 'cheque')) && $balance > 0) {
$status = 'credit';
}
else {
$status = $payment_type;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment