Updated sample 3 according to PHP sample 3
Updated sample 4