How to run php code without any server
means like HTML can we run php code?
or use xamp wamp lamp on a pc. wamp = windows apache mysql php. lamp = Linux Apache mysql php.
No! You cant run a .php file without any local web server! Use xampp , wamp, or mamp local web seever in order to run your .php file
in our PC on window 7 we have any server by default?
You have to install local web server xampp
[Wow, how many people think that it's impossible to run php code without server...] Yes, you can run PHP code without server. Install PHP alone (even then it has it's own built-in or should I say "packed-in with interpreter" server but I never tried it, and yuou can be sure it's unefective to use it for php code as a server-side code). You can then run a php code writen for example in one of simpliest text editor(s) (notepad, nano, vim... uh, no, the last one isn't so "simple"😀) and saved as a .php file. But (and thats why some people think that this is imposible at all I guess) you wouldn't be able to "output" results in a "web-view" as in browser (or just "in browser") simple one code will output something in console, and I've heard PHP too has libraries/frameworks to build some GUI applications (but never tried those tools too… and what's for? ☺ when there are C/C++, Java, C#, Python if you are okey with interpreted languages and their "speed"). I guess yo won't get predefinedc vartiables for example too :-) and so on. So it's not common use of PHP [but still " yes, you can].
Currently PHP including built-in webserver, just run this syntax in your PHP Project folder: php -S localhost:8000 Requirement: min PHP 5.4.0 #You can't run PHP without webserver
@Garuda What will happen after this: php myfile.php -r if myfile.php will contain: <?php echo "Helo world!"; ?>
no, you need to get a server.