updated/simplified PHP example code