Adding missing PHP samples

Fixes #478, #479, #480, and #481.
I would leave out the `$callback` parameter and the associated function definition so this code is consistent with its counterpart in other languages.