Php Array Check If Last Element Of Sets In Mathematics