Monday 4 June 2018

comparison operator in php





<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>comparison operator..</title>

</head>



<body>

<?php

$a=10;

$b=5;

$c=10;







if($a === $b)

{

echo " <p style='color:green'>success </p>" ;

}



else

{

echo "<p style='color:red'> failure </p>" ;

}

echo "<h1> >= Operator </h1>";



echo "a>=b =".($a>=$b);



echo "<h1> <= Operator </h1>";



echo "a<=b =".($a<=$b);



echo "<h1> == Operator </h1>";



echo "a==b =".($a==$b);



echo "<h1> != Operator </h1>";



echo "a!=b =".($a!=$b);







echo "<h1> === Operator </h1>";



echo "a===c =".($a===$c);







?>





</body>

</html>

Assignment Operator in php





<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>assignment operator</title>

</head>



<body>



<?php

$x=4;



echo "<h1> = operator </h1> ";





$y=$x;



echo "value of y = ".$y;

echo "<br/>value of x = ".$x;



echo "<h1> += operator </h1> ";



$y+=$x; // y=y+x

echo "value of y = ".$y;

echo "<br/>value of x = ".$x;



echo "<h1> -= operator </h1> ";



$y-=$x; // y=y-x

echo "value of y = ".$y;

echo "<br/>value of x = ".$x;





echo "<h1> *= operator </h1> ";



$y*=$x; // y=y*x

echo "value of y = ".$y;

echo "<br/>value of x = ".$x;





echo "<h1> /= operator </h1> ";



$y/=$x; // y=y/x

echo "value of y = ".$y;

echo "<br/>value of x = ".$x;





















?>









</body>

</html>

Airthmetic Operator in PHP



<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Airthmatic operator</title>

</head>



<body>



<?php

$a=10;

$b=5;



echo "<h1>Addtion </h1>";

echo "a + b = ".($a+$b);



echo "<h1>Subtraction </h1>";

echo "a - b = ".($a-$b);



echo "<h1>Multiplication </h1>";

echo "a * b = ".($a*$b);



echo "<h1>Division </h1>";

echo "a / b = ".($a/$b);



echo "<h1>Modulus </h1>";

echo "a % b = ".($a%$b);



echo "<h1>Exponent </h1>";

//echo "a ^ b = ".($a**$b);

echo "a ^ b = ".pow($a,$b);

























?>













</body>

</html>

variable scope in php





<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>variable scope..</title>

</head>



<body>



<h1>variable scope </h1>



<?php

echo "<h2>Local variable </h2>";



function myfun1()

{

$x=15; //local .......

echo "value of inside the function  x = ".$x;

}





myfun1();

//echo "value of outside the function x = ".$x;



echo "<h2>Global variable </h2>";



$y=10;

$z=20;

function myfun2()

{

//echo "value of y inside the function = ".$y;

}



myfun2();



echo "value of y outside the function = ".$y;





echo "<h2>Global keyword </h2>";

function myfun3()

{

global $y,$z;

$y=$y+$z;

echo "value of y inside the function = ".$y;



}



myfun3();





echo "<h2>static variable </h2>";



function myfun4()

{

static $a=0;

$a++;

echo "value of a inside the function = ".$a."<br/>";





}



myfun4();

myfun4();

myfun4();



?>













</body>

</html>

Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...