Vous êtes sur la page 1sur 3

1.

ini_set('session.save_path', 'D:\EasyPHP 2.0b1\www\moodledata/sessions');

2.
echo "<br>Session save path is ", session_save_path();
3.
http://www.php.net/manual/en/timezones.asia.php
date_default_timezone_set('Asia/Shanghai');
4. list

5.
foreach($fgnDeets1 as $key => $value){
$fgnDeets[$key]=mysql_escape_string($value);
}

6.
$source = imagecreatefrompng($parse_array["items"][$h]["file"]);
// Resize
imagecopyresized($thumb,
$source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
//$src = imagepng($thumb
);
$rotate_value = -($parse
_array["items"][$h]["rotation"]);
$src_path = "graphics/th
umb/". $parse_array["items"][$h]["file"];
$rotate = imagerotate($t
humb, $rotate_value , 0);
$trans_colour = imagecol
orallocatealpha($rotate, 0, 0, 0, 127);
imagecolortransparent($r
otate,$trans_colour);
imagepng($rotate, $src_p
ath);
//imagepng($thumb, $src_
path );
$src = imagecreatefrompn
g($src_path);
imagecopymerge($dest, $src,$parse_array["items"][$h]["x"], $parse_array["items"]
[$h]["y"], $parse_array["items"][$h]["sx"], $parse_array["items"][$h]["sy"], $p
arse_array["items"][$h]["fwidth"], $parse_array["items"][$h]["fheight"], 50);

7.
auto increment alphanumberic string
function FlightNo_Increment($string, $increment=1, $forbidden=array()) {
$regex = "(_?)([0-9]+)$";
ereg($regex, $string, $regs);
$z = empty($regs) ? '' : $regs[2];
$neu = ((int) $z) + $increment;

$string = ereg_replace((($z=='') ? "$" : $regs[0]."$"), ((string) $regs[1]).((st


ring) $neu), $string);
if (in_array($string, $forbidden)) $string = FlightNo_Increment($string, $increm
ent, $array);
return $string;
}
8.
echo "<hr> Working below one to get current starting weekday";
echo date('Y-m-d', mktime(1, 0, 0, date('m'), date('d')-date('w'), date('Y'))) ;

9.
$rows1= array();
$rows = $database ->loadObjectList();
//if (count($rows1)== 0 ) $rows1= array(
);
$rows1 = array_merge_recursive($rows1,$r
ows);

10.
$tourlist[] = mosHTML::makeOption( '0', 'Select Week', 'tournamentid', 'text
' );
$tournaments_array = array_merge( $tourlist,$tourna
ments);

11.

$string='h8';
//$string='v15';
if (ereg("h",$string,$result) ) {
echo "valid".$result[0];
}
else{
echo "invalid";
}
12. For IE
if (array_key_exists('HTTP_USER_AGENT', $_SERVER)) {
$is_ie6 = strpos(strtolower($_SERVER['HTTP_USER_
AGENT']), 'msie 6') !== false;
if ($is_ie6) {
$style = "style=\"padding-left:0px;$widt
h\"";
}
else {
$style = "style=\"padding-left:20px;$wid
th\"";
}
}

13.convertin numeric month to Jan format


echo $month=date('M',mktime(1,1,1,$_POST["showmonth"] ,$_POST["showdate"], $_POS
T["showyear"]));

14.
if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {

15.
$currentTime = date('H:i:s A', strtotime($current_hour .' hour'));
$currentDate = date('l', strtotime($current_hour .' hour
'));
//$currentDate = date('l', strtotime('-1 day'.$current_h
our .' hour'));

Vous aimerez peut-être aussi