Client machines do not have access to source code for server-side processes or any PHP variables: only output. Unless you provide a specific mechanism to display variables (i.e. debugging functions like var_dump) in your PHP script, then it is secure. Also, your server has to be set up to process PHP files and render the script's output instead of delivering the raw code as if it were plain HTML, but simply installing PHP usually takes care of that problem.
Then there is a broader issue of level-of-access with collaborators or others who have server access: and that is why it is good to house your credentials in a separate file that you exclude from public environments like GitHub. That is all I will say about that, as every case is different, especially when you toss in file permissions and file ownership. It should be noted, however, that the MySQL user permissions can also be limited, which adds an extra layer of insurance in case the wrong person comes across the credentials.