This app was mentioned in 2 comments, with an average of 4.00 upvotes
First of all, php ist not a compiled language so you would have to run an interpreter on your phone, possibly a web server. A quick google search yielded this as a result if you run android.
In case anyone is wondering if there is something similar for Android, there is this. Has php7 with a load of extensions enabled.
There is also a decent editor.