PHP Cheat Sheet

Alt Text

Listed below is the code that I use most in PHP. I will be adding to it on an ongoing basis. If you have a question about how to use any of the code please feel free to add a comment at the bottom of the page.

echo
// echo

<?php echo $nfiles; ?>
<?php echo "word"; ?>

Declare the variable as global
<?php global $td; ?>


<?php global $td; ?> <?php $td = "variable"; ?>

Include
<?php include 'vars.php'; ?>

Send Variables
Form
<input type="hidden" name="varname" value="<?php echo $bee_email; ?>">
$var_value = $_POST['varname'];
Send Variables
URL
<a href="page.php?myNumber=100">Send variables</a>
<?php
$num = $_GET['myNumber'];
?>
stripslashes
Remove \ form the output
echo stripslashes($bee_footer);

Comments are closed.