PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
No. PHP does not have a global variable scope* - variables defined outside functions are not available inside functions. There is file scope and there is function scope and they are completely separate**.
Pass $mypass as an argument to your function.
* Except the special "superglobal" variables $_GET, $_POST, etc.
** There are ways around this that you should not use.