Can i do php in visual studio?

First let me say I've never used PHP but I'm looking to learn it, so my question is this how do you use PHP within Visual Studio Ultimate? is it similar to how you declare JQuery i.e

$(document).ready(function () 
{ 
    // Code goes here?  
});

I've done multiple searches on Google, but I don't get the answer I'm looking for.

Or do I need a complete different bit of software to use it?

Can i do php in visual studio?

Markus Safar

6,2025 gold badges27 silver badges42 bronze badges

asked May 10, 2012 at 7:22

Can i do php in visual studio?

Code RatchetCode Ratchet

5,57216 gold badges75 silver badges132 bronze badges

4

Maybe we should help you with a big misunderstanding on your side first: PHP is (like ASP.NET or whatever you used to far) a server side language while javascript is client side.

This means that PHP will run on your webserver and create a HTML page dynamically which is then sent to the browser. Javascript in turn is embedded (either directly or as a referenced file) into this HTML page and runs in the browser.

Maybe you can now understand why your approach so far could never work out.

Can i do php in visual studio?

Zze

17.2k12 gold badges81 silver badges113 bronze badges

answered May 10, 2012 at 8:21

Can i do php in visual studio?

2

Try Visual Studio Code. Very good support for PHP and other languages directly or via extensions. It can not replace power of Visual Studio but it is powerful addition to Visual Studio. And you can run it on all OS (Windows, Linux, Mac...).

https://code.visualstudio.com/

answered Dec 3, 2016 at 17:55

mojmir.novakmojmir.novak

2,3602 gold badges24 silver badges31 bronze badges

3

Maybe it's possible to debug PHP on Visual Studio, but it's simpler and more logical to use Eclipse PDT or Netbeans IDE for your PHP projects, aside from Visual Studio if you need to use both technologies from two different vendors.

Quirk

1,2674 gold badges15 silver badges28 bronze badges

answered May 10, 2012 at 8:28

Can i do php in visual studio?

ConexConex

8318 silver badges17 bronze badges

1

answered Jan 10, 2014 at 18:58

ReviousRevious

7,55230 gold badges96 silver badges145 bronze badges

4

I don't understand how other answers don't answer the original question about how to use PHP (not very consistent with the title).
PHP files or PHP code embedded in HTML code start always with the tag and ends with ?>.

You can embed PHP code inside HTML like this (you have to save the file using .php extension to let PHP server recognize and process it, ie: index.php):


   Hello World!
" ?>

or you can use a whole php file, ie: test.php:

$mycontent";
?> // is not mandatory to put this at the end of the file

there's no document.ready in PHP, the scripts are processed when they are invoked from the browser or from another PHP file.

answered Mar 9, 2017 at 10:40

2

How do I get PHP on Visual Studio?

You can install an add-on with the extension manager, PHP Tools for Visual Studio. If you want to install it inside VS, go to Tools > Extension Manager > Online Gallery > Search for PHP where you will find PHP Tools (the link above) for Visual Studio. Also you have VS. Php for Visual Studio.

Can I run PHP file in Visual Studio Code?

Download and install Visual Studio Code. Configure PHP linting in user settings. Download and install the PHP Debug extension from the Visual Studio Marketplace. Configure the PHP Debug extension for XDebug.

How do I create a PHP project in Visual Studio?

New Project from Existing Code.
Project From Existing Code Menu. Open File | New | Project From Existing Code... ... .
Then select PHP and click Next >.
This will display the following wizard. ... .
Click Finish, Visual Studio will create a new project ( ..

How do I create a new PHP file in Visual Studio Code?

PHP in Visual Studio Code.
Now, the folder is linked and we can access it from Visual Studio Code..
To create a new file, Right Click in the “Explorer” section of Visual Studio Code (inside the folder) and hit “New File”. ... .
In the url box, type the location to your PHP project and your PHP file and hit “Enter”..