fibonacci in php

<?php if(!empty($_GET[‘upto’])){ $upto = $_GET[‘upto’]; }else{ $upto = “”; } function getfibo($upto=5){ $second =1;  $first  =0; $fibo_arr[] = $first; $fibo_arr[] = $second; for($i=1; $i<$upto; $i++){ $fibo_arr[]= ($fibo_arr[$i-1] + $fibo_arr[$i]); } $fseries =  implode(‘,’,$fibo_arr); return $fseries; } echo getfibo($upto); ?>

Routing using htaccess

RewriteEngine on RewriteBase / ###Maintainance ## RewriteRule ^maintainanace/$ maintain.php RewriteRule ^logout/$ logout.php RewriteRule ^logout$ logout.php RewriteRule ^products/([^/]*)/([^/]*)/$ products.php?slug=$1&id=$2 [L]

Show location in Google map using php

<?php $location=”Kolkata”; ?> <div style=”width: 100%”> <iframe width=”100%” height=”480″ frameborder=”0″ scrolling=”no” marginheight=”0″ marginwidth=”0″ src=”https://maps.google.it/maps?q=<?php echo $location;?>&output=embed”></iframe> </div>

Image upload in php

#IMAGE UPLOAD if ($_FILES[‘list1’][‘name’] != “”) { $allowed_ext = array(“jpg”, “jpeg”, “png”, “gif”); $extension = explode(‘.’, $_FILES[“list1”][“name”]); $ext = strtolower(end($extension)); if (in_array($ext, $allowed_ext)) { $newname = rand(10000, 99999) . “_” . time() . “.” . $ext; $loc = “images/”. $newname; move_uploaded_file($_FILES[“list1”][“tmp_name”], “./” . $loc); } }