Random Number
$randomnumber= rand(1,10);
Replace 1 and 10 with the range you want to pick a number between.
TextSnippets > php >
Post code snippets. Sort by tags, people, people and tags, etc..
| « Earlier | 10 items total | Later » |
$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"<tr>";} ?>
Insert other tags here.
<? if ($set_table == "2") {echo"</tr>"; $set_table="0";} ?>
{/exp:gallery:categories}
</table>
{exp:allow_eecode}{body}{/exp:allow_eecode}
<p>Bla bla regular entry text</p>
{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 ?.<br />";
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);
| « Earlier | 10 items total | Later » |