PHP is a server-side scripting language usually written alongside HTML. The difference between them is where HTML is interpreted directly by the user's browser, a PHP script is first interpreted by the server, executed, and then sent to the browser along with the HTML. Thus, the server your PHP script is on needs to be able to support PHP; you'll have to ask your host.
PHP code is very different from HTML code, however if you already know HTML then PHP shouldn't be hard to learn. Just like HTML, PHP has tags:
| Start Tag | End Tag |
| <?php | ?> |
| <script language="php"> | </script> |
| <? | ?> |
| <% | %> |
<?php
print("my first PHP script!");
?>
Here, the print() function will send the data (a collection of characters called a string) between the parenthesis to the browser. Strings must always be surrounded by either single or double quotation marks, however if the data is a number or a boolean (true/false) value, then it doesn't need quotation marks. The semicolon (;) ends the PHP statement.<?php print("my first PHP script!"); ?>
That's it! Save the file as "test.php" and upload it to your server. It's important that you save it with a .php extension, otherwise the server won't know to interpret the script.Can't find what you're looking for? Try searching for it:
© 2000-2008 Xentrik.Net