Welcome Guest, Not a member yet? Register   Sign In
PHP syntax
#1

[eluser]Iwasignited[/eluser]
Hello everyone.
I know this problem is not Codeigniter related but this forum is my first PHP programming forum (I dont know any other) so I decided to post it here, please help me.

I see some people write this
Code:
&$var
I'd like to ask what '&' means here?
And also
Code:
===
,
Code:
!==
.

Looking forward to hearing from you soon.
Thanks so much.

Sorry for my English
#3

[eluser]WanWizard[/eluser]
Using an & means you're referring to the variable by reference: http://php.net/manual/en/language.references.php

=== means you not only want to compare the value, but also the type: http://www.php.net/manual/en/language.op...arison.php

!== means the same, but in a 'not' context.

So:
Code:
'1' === 1; // this is FALSE
1 === 1; // this is TRUE
'1' !== 1 // this is TRUE
1 !== 1 // this is FALSE

Compare with:
Code:
'1' == 1; // this is TRUE
1 == 1; // this is TRUE
'1' != 1 // this is FALSE
1 != 1 // this is FALSE
#4

[eluser]Tominator[/eluser]
I show you example with &:
Code:
$a = 1;

function without($input)
{
return $input + 5;
}

function with(&$input)
{
return $input + 5;
}

echo without($a); // 6
echo $a; // 1

echo with($a); // 6
echo $a; // 6




Theme © iAndrew 2016 - Forum software by © MyBB