Input array= array("test"=>array("s1"=>array(),"s2"=>array())) foreach(array_keys($free_tim) as $k=>$v){ //echo "$v===".count($free_tim[$v])."
"; foreach((array_keys($free_tim[$v])) as $f=>$s){ foreach(($free_tim[$v][$s]) as $g=>$e){ $te[$v][] = $e; } } } Output array = array("test"=>array())
Html, JAVA,DOTNET,Javascript, PHP, and JQuery Scripts and its issues with solutions
Thursday, 10 April 2014
PHP array merging & combine for associative array
Wednesday, 9 April 2014
A Simple PHP Thumbnail Image Resize Script
Step 1: To create Test.php & copy paste below code <?php session_start(); header("Pragma: public"); header("Cache-Control: max-age = 604800"); header("Expires: ".gmdate("D, d M Y H:i:s", time() + 604800)." GMT"); function thumbnail($image, $width, $height) { if($image[0] != "/") { // Decide where to look for the image if a full path is not given if(!isset($_SERVER["HTTP_REFERER"])) { // Try to find image if accessed directly from this script in a browser $image = $_SERVER["DOCUMENT_ROOT"].implode("/", (explode('/', $_SERVER["PHP_SELF"], -1)))."/".$image; } else { $image = implode("/", (explode('/', $_SERVER["HTTP_REFERER"], -1)))."/".$image; } } else { $image = $_SERVER["DOCUMENT_ROOT"].$image; } $image_properties = getimagesize($image); $image_width = $image_properties[0]; $image_height = $image_properties[1]; $image_ratio = $image_width / $image_height; $type = $image_properties["mime"]; if(!$width && !$height) { $width = $image_width; $height = $image_height; } if(!$width) { $width = round($height * $image_ratio); } if(!$height) { $height = round($width / $image_ratio); } if($type == "image/jpeg") { header('Content-type: image/jpeg'); $thumb = imagecreatefromjpeg($image); } elseif($type == "image/png") { header('Content-type: image/png'); $thumb = imagecreatefrompng($image); } else { return false; } $temp_image = imagecreatetruecolor($width, $height); imagecopyresampled($temp_image, $thumb, 0, 0, 0, 0, $width, $height, $image_width, $image_height); $thumbnail = imagecreatetruecolor($width, $height); imagecopyresampled($thumbnail, $temp_image, 0, 0, 0, 0, $width, $height, $width, $height); if($type == "image/jpeg") { imagejpeg($thumbnail); } else { imagepng($thumbnail); } imagedestroy($temp_image); imagedestroy($thumbnail); } if(isset($_GET["h"])) { $h = $_GET["h"]; } else { $h = 0; } if(isset($_GET["w"])) { $w = $_GET["w"]; } else { $w = 0; } thumbnail($_GET["img"], $w, $h); ?> Step 2: Index.php
Monday, 7 April 2014
Export in Excel doc in php
//header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
//header("Content-Length: " . strlen($out));
header("Content-type: application/vnd.ms-excel");
//header("Content-type: application/octet-stream, charset=UTF-8; encoding=UTF-8");
header("Content-Disposition: attachment; filename=Deal_calender.xls");
$out = html_entity_decode( $out ,ENT_NOQUOTES,'utf-8');
$out = chr(255).chr(254).iconv("UTF-8","UTF-16LE",$out);
echo $out;
exit;
Subscribe to:
Posts (Atom)