correct snippets for this in php