There are 3 styles of PHP comments
// comment a single line
# comment a single line (perl-style
/*
comment block
*/
Yep. We do it all the time. One way is to simply tell PHP that you want the tags echoed. Like so: <?php echo('<b>Hi</b> Nice to meet you!'); ?> Sometimes you want instead to simply use the PHP in parts of a page and leave the rest. You can do this, too. <body> <div class="login"> <?php if($user->loggedIn()){ ?> <b>Hi!</b> <?php }else{ ?> <!-- HTML FORM HERE --> <?php } ?> </div> </body>
PHP code blocks start with <?php and end with ?>.
PHP is server-side, the browser itself does not interpret it. Rather, the browser sends a query to the server, and the PHP scripting generates custom HTML document. It is this HTML that you are seeing the source code of.
PHP and C are two different programming languages that cannot directly interact with eachother. You can have a program made with C call a PHP script, using its output (an indirect interaction), but there's no way to "embed" PHP into C code.
PHP code is never executed by the web browser, and the source code of a PHP file will normally not be sent to the browser at all. In this sense, there is no designation of PHP code on the client's side-- it all appears to be HTML, text, XML, or whatever other type of output you choose to produce. On the server side, PHP scripts are inside of files ending in ".php". Script inside of these PHP files start with . Anything outside of these tags will be sent to the browser as static ("unchanging") output. The code inside the PHP tags start from the top, and are executed sequentially from top to bottom, unless flow control is used to modify the control of the scripts (such as functions, while loops, switch and if constructs, etc).
< ?php // This is an example of comment in PHP /* This is another example of comment in PHP and we can write comments in multiple lines using this method */ ? >
$this is not a comment;//this is a comment/*this is alsoacomment */
We can use php tags in different ways. <?php //php code to be written here ?> OR <? //php code ?> This tag will not work when we using editors such as macromedia dreamweaver. OR < script language="php"> //php code </script>
For one line comment // Your one-line comment here For multi line comments /* * Multi-line comments here * some explanation * @author The author of the code * @version The version of the code * @date The date code was written * @params The parameters of the code * @return What is returned. For eg. a string, a number or a boolean */ Not everything written is multi-line is essential. Just write a comment in way that you and people who see your code in the future understand what that piece of code does
There are many ways to comment in PHP, all of them valid: /* Classic C style, which allows you to comment blocks rather than single lines */ // C++ Style, which remarks the remainder of a single line # bash style, which also is a rest-of-the-line comment
You'd need PHP and mySQL knowledge for this. Search Google for "Free PHP Comment Scripts".
Yep. We do it all the time. One way is to simply tell PHP that you want the tags echoed. Like so: <?php echo('<b>Hi</b> Nice to meet you!'); ?> Sometimes you want instead to simply use the PHP in parts of a page and leave the rest. You can do this, too. <body> <div class="login"> <?php if($user->loggedIn()){ ?> <b>Hi!</b> <?php }else{ ?> <!-- HTML FORM HERE --> <?php } ?> </div> </body>
I have little idea of your question however <?php #code in here ?> is the starter for PHP, and then anything outside is HTML.
PHP code blocks start with <?php and end with ?>.
The file extension for PHP is .php
PHP is server-side, the browser itself does not interpret it. Rather, the browser sends a query to the server, and the PHP scripting generates custom HTML document. It is this HTML that you are seeing the source code of.
PHP and C are two different programming languages that cannot directly interact with eachother. You can have a program made with C call a PHP script, using its output (an indirect interaction), but there's no way to "embed" PHP into C code.