My PHP Reference

Index -|- Personal Samples -|- Home

Preamble

PHP is a POWERFUL (scripting) language, that is now available for use on most server space ... the web file extension will be .php, and this will be passed through the server php runtime, before being passed back to the browser as HTML ... This is my own personal php reference page. It makes no attempt to be all inclusive.

code blocks, __FILE__, getcwd, help

top


Code Blocks

In files with the .php extension, within the HTML, PHP code blocks can be encased as follows :-

<?php
echo "Hello World";
?>

top


getcwd - Show current work directory

Built in function that shows the current work directory :-

<html>
<head>
<title>show current work directory</title>
</head>
<body>
<h1 align="center">show current work directory</h1>
<?php
echo "<p>root=<b>".getcwd()."/.</b></p>\n";
echo "<p>file=<b>".__FILE__."</b></p>\n";
?>
</body>
</html>

Link to dir01.php ...

top


PHP Help

I find the online PHP HELP is fantastic ;=)) Like placing [ php opendir ] into a Yahoo! search, gives you many links, like - www.php.net/opendir - which puts you in the PHP Manual, and there are ALWAYS examples, ready to cut, paste and try for your self ...

I use some great PHP scripts to massage JPG image - try a Yahoo! search [php exif_thumbnail], and [php imagecreatefromjpeg] - extracting any EXIF information, writing a 'thumb', writing a normal image, and finally an image without the EXIF ... this is using it in a local WIN32 runtime environment, as mini-applications ...

To learn more exactly HOW the PHP has been configured on your server, you can use the phpinfo() function. Create a file, called say phpinfo.php, and add the single line -

<?php phpinfo(); ?>

Unload this to your site, and point your browser at it. You should be rewarded with a BIG list of parameters, showing what is enabled, and disabled in your particular server. You can compare it to what is enabled in my GoDaddy server spaces through this URI ...

top


checked by tidy  Valid HTML 4.01 Transitional