Php Check If Last Element Of Array Python Initialize Variable To Null