You can use any programming language for a hidden service. The reason why most of the hidden services using PHP might be the same why many services in the web use PHP. ;)

Your hidden service basically needs to listen on some TCP port. This can be for instance a webserver. Your application takes the request from that webserver and does something with it. You can also use the infamous Python example: python -m SimpleHTTPServer to service sites via hidden services.

So basically you write your application like you did it using no hidden services. When you are finished, you just tell Tor to forward the requests from the hidden service to the service you are running: HiddenServicePort 80 127.0.0.1:80. Each request which arrives at port 80 of your hidden service is mapped to port 80 on your machine. So when your hidden service also has a public address and serves the same service on that address, a client will get the same answer on the public way as on the hidden service way. It does not depend on programming languages.