Random Number
$randomnumber= rand(1,10);
Replace 1 and 10 with the range you want to pick a number between.
TextSnippets > nothingless > php
2818 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
Sasha http://nothing-less.net
$randomnumber= rand(1,10);
© Copyright 2004 - <?php echo date("Y") ?>
<?php $nextmonth = mktime(0, 0, 0, date("m")+1, 1, date("Y")); echo date("F", $nextmonth); ?>
$set_table="0"; ?> <table cellpadding="5" border="0"> {exp:gallery:categories gallery="{gallery_name}"} $fs_table = $set_table +1; if ($set_table == "1") {echo"";} ?> Insert other tags here. if ($set_table == "2") {echo" "; $set_table="0";} ?> {/exp:gallery:categories} </table>
$today = date("F j, Y");
{exp:allow_eecode}{body}{/exp:allow_eecode}
<p>Bla bla regular entry textp> {exp:allowphp} echo "This will be processed as PHP."; {/exp:allowphp}
$fs_refer= $_SERVER ['REQUEST_URI']; $fs_refer = explode("?", $fs_refer); echo "$fs_refer[0] is now a URL without ?.
"; echo "$fs_refer[1] is the bit that used to follow the ?."; ?>
$varshort = substr($var,0,25); echo "$varshort"; ?>
// trim spaces from the beginning and the end of the variable $field_name = trim($field_name); // strip all HTML from the variables $field_name = strip_tags($field_name); // change the case of the variable to capitalize (It Will Look Like This - handy for Name fields) $field_name = ucwords(strtolower($field_name)); // change the case of the first character to uppercase, the rest to lowercase (It will look like this) $field_name = ucfirst(strtolower($field_name)); //change the case of the variable to lowercase $field_name = strtolower($field_name); // change the case of the variable to uppercase $field_name = strtoupper($field_name); ?>
$text = preg_replace('/\s+/', ' ', $text); ?>
$variable = trim($variable);