I woluld like to like to learn php I just wanted to know Is there any tool available online whre i can run my php code and see the result . If any body knows about it . Please let me know
There are all sorts of tools available; which one(s) will be right for you depends on what you are looking for.
At one end of the spectrum, there is the console-type tool where you type in a line or two of code then run that to see what that little bit of code does immediately. In the programming world, this is called a "
REPL" (for
Read - Eval - Print - Loop). Most of the online teach-and-type coding course (like the PHP track at Codeacademy.com) have a subset of PHP implemented in a JavaScript-based REPL on the web page so you can see what your code does right away. But it is just a subset of PHP, and it doesn't work exactly the same way as "the real thing" if you use syntactic variations the JS-based interpreter doesn't expect. There are also "real" PHP REPLs like Joel Kemp's effort at
phpepl.cloudcontrolled.com. (And you can find the source code for that
on GitHub if you want to implement it on your own machine.)
The problem with a REPL is that you can only do a handful of lines at a time before you lose the ability to see what's happened before, and all of your code goes away between sessions (you can't really save your work without copying/pasting into a text editor). It's not easy to work with databases or external resources, etc., and all you get is the text output of your code, so you can't easily see what it looks like as a web page. Oh, and since you're running on someone else's web server, there are a lot of functions/commands that won't be available to you.
The next step up would be to install a web server environment with PHP and a database on your own machine. Two of the popular ones are
WAMP Server (Windows only) and
XAMPP. WAMP Server is easier to set up (it's just a one-click install); XAMPP has more features (like Perl), but may require a bit more knowledge to configure. In either case, you can simply create PHP pages in your text editor of choice, save them to the WWW folder in the web server directory the program creates for you, and open those pages in your browser, refreshing when you save changes to the page.
You can combine a local web server with a PHP IDE (
Integrated Development Environment). That will consist of a "smart" code editor, one that does syntax highlighting and can give you help/hints about the functions and objects you are using, point out your mistakes as you make them, and usually allows you to run and debug your code. The only PHP IDE I've tried that isn't annoyingly slow/sluggish
and has all of the features a good IDE should have is
JetBrains PHPStorm Unfortunately, it's not free (in either sense,
gratis or
libre). There is also NetBeans and a whole host of Eclipse-based IDEs, including Dev-PHP, Zend Studio and Aptana Studio. It is really easy to get overwhelmed by an IDE though, especially as a beginner. I'd stick to just a server, text editor and browser(s) to begin with.
Finally, you can just get a web hosting account and use a directory in that account as your playroom. (You usually have to have a proper web site running somewhere on the account, but you're also usually allowed to have development files.) That will allow you to test code running under the actual security settings/restrictions your host is using, and use the same databases and permissions, etc. I wouldn't suggest that until you have a few of the basics under control -- your host won't like it much if you create infinite loops and so on, or crash the server altogether.