Skip to content

Instantly share code, notes, and snippets.

@egin10
Created November 4, 2019 02:06
Show Gist options
  • Save egin10/7df3579c697ae63ac70617d7d7f4ac59 to your computer and use it in GitHub Desktop.
Save egin10/7df3579c697ae63ac70617d7d7f4ac59 to your computer and use it in GitHub Desktop.
class Core{
//This method use for getting some string from long string.
private function getStringBetween(String $teks, String $sebelum, String $sesudah): String
{
$teks = ' '.$teks;
$ini = strpos($teks, $sebelum);
if($ini == 0) return '';
$ini += strlen($sebelum);
$panjang = strpos($teks, $sesudah, $ini) - $ini;
return substr($teks, $ini, $panjang);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment