Flexible? What do you find not flexible with php? You can extend the language however you want.
Even to add security.