Thursday, April 14, 2011

How to Difference Equal, Equal Double and Triple Equal

function equal (=) in a pendeklarasial variable or statement if else, is a common method used for a variety of process logic .. Just an example for the login (username and password match with the data in the database).search persaan a string, integer, and so forth. 
Apparently there are differences of usage utility function equal, double and triple equel equel.
Equal. 
commonly used to declare a value / variable. 
ex ..
1"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">
2"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">$param = 12; $ Param = 12;
3"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">echo $param; echo $ param;
4"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">?> ?>
then the output of this equation is 12. 
$ param can be concluded that the same value with 12.
Double Equal. 
used to find the equality statement that is true or false .. 
ex ..
1"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">
2"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">$number = 12; $ Number = 12;
3"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">if ($number==14) { if ($ number == 14) {
4     "_tipon(this)" onmouseout="_tipoff()"> class="google-src-text" style="direction: ltr; text-align: left">echo "Nomer 14"; echo "Number 14";
5"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">} else { } Else {
6     "_tipon(this)" onmouseout="_tipoff()"> class="google-src-text" style="direction: ltr; text-align: left">echo "Bukan No 14"; echo "No No 14";
7"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">} }
8"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">?> ?>
the statement above. $ Number has a value of 12, and $ number == 12 would return the value false, then the output is not No. 14.
Triple Equal. 
that is used to find equations that statement is true and also compares the data type variables 
ex ..
1"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">
2"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">$number = 10;   //integer $ Number = 10; / / integer
3"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">$number2 = "10";   //string $ Number2 = "10"; / / string
4"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">//statement 1 / / Statement 1
5"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">if ($number==$number2)  { if ($ number == $ number2) {
6 "_tipon(this)" onmouseout="_tipoff()"> class="google-src-text" style="direction: ltr; text-align: left">echo "variable bernilai sama";echo "variable equal value";
7"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">} else { } Else {
8 "_tipon(this)" onmouseout="_tipoff()"> class="google-src-text" style="direction: ltr; text-align: left">echo "variable bernilai tidak sama"; echo "variable value does not equal";
9"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">} }
10 
11"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">//statement 2 / / Statement 2
12"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">if ($number===$number2)  { if ($ number === $ number2) {
13 "_tipon(this)" onmouseout="_tipoff()"> class="google-src-text" style="direction: ltr; text-align: left">echo "variable bernilai sama";echo "variable equal value";
14"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">} else { } Else {
15 "_tipon(this)" onmouseout="_tipoff()"> class="google-src-text" style="direction: ltr; text-align: left">echo "variable bernilai tidak sama"; echo "variable value does not equal";
16"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">} }
17"_tipon(this)" onmouseout="_tipoff()"> class="google-src-text"style="direction: ltr; text-align: left">?> ?>
to statement 1. output is true. because it only validates the value. 
then the output variables equal.
for statement 2. the output is false. because in addition to examining the value but also check the type of value. 
then the output value is not the same variable.
hopefully useful

No comments:

Post a Comment