Skip to content

Instantly share code, notes, and snippets.

@sohelrana820
Last active December 14, 2015 18:39
Show Gist options
  • Save sohelrana820/5130804 to your computer and use it in GitHub Desktop.
Save sohelrana820/5130804 to your computer and use it in GitHub Desktop.
This is Batch tracker
<?php
public function Batch($BatchNo){
if($BatchNo==1){
return "First Batch";
}
else if($BatchNo==2){
return "Second Batch";
}
else if($BatchNo==3){
return "Third Batch";
}
else if(substr($BatchNo,-1)==1){
if($BatchNo-1==10 || $BatchNo-1==110){
return $BatchNo."th Batch";
}
else{
return $BatchNo-1 ." First Batch";
}
}
else if(substr($BatchNo,-1)==2){
if($BatchNo-2==10 || $BatchNo-2==110){
return $BatchNo."th Batch";
}
else{
return $BatchNo-2 ." Second Batch";
}
}
else if(substr($BatchNo,-1)==3){
if($BatchNo-3==10 ||$BatchNo-3==110){
return $BatchNo."th Batch";
}
else{
return $BatchNo-3 ." Third Batch";
}
}
else{
return $BatchNo."th Batch";
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment