Posts

Loop

$x=1; do{  echo $x;  $x++; }while($x<=10); //At first code will be executed in do{} and then will be continuing checking condition if condition true then will go inside in do{} to execute code otherwise not. An important thing about do{}while() is At the very first execution is not depend on condition but from the second execution depend on condition. $x=1; while($x<=10){  echo $x;  $x++; } //At the beginning check the condition if condition is true then execute otherwise not. The characteristic of this loop is this loop run clock wise. for($i=1; $i<=10; $i++){  echo $i; } // This loop run anti-clock wise first initiate value, then check condition if condition is true then go to execution, after completing the execution go to the third parameter to increment initialized value. continue; //Use to skip a single execution in loop break; //Use to get out from a loop;

Putty and Filefizlla installation on Fedora

Putty Installation on Fedora su- yum install putty Filezilla Installation on Fedora yum -y install filezilla

Form page on view mode by JavaScript

$(document).ready(function(){   $('#myForm :input').attr('disabled','true');   $('#myForm :input[type=submit]').hide(); });

DB::statement(); for serial in table

DB::statement(DB::raw('set @serial=0')); $list = Designation::orderBy('id','desc')          ->get([          'id',          'title',          DB::raw('@serial := @serial +1 as serial')           ]);

Getting key from an array by value

if(in_array($data['question_type],$questionTypes)){    $examTypeId = array_search($data['question_type'],$questionTypes); }

Object to array conversion

$examTypes = ExamType::lsits('exam_name','id'); $questionTypes = json_decode(json_encode($examTypes), True );

List Query for select box in Laravel

ExamType::lists('exam_name','id');