• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
isset: Strange behaviour

#1
[eluser]libnac[/eluser]
Someone knows why this sentence works

Code:
if(!isset($hello)) {
..
}

and this sentence doesn't work?

Code:
if(!isset($this->input->post("Ds_AuthorisationCode"))) {
..
}

#2
[eluser]Matthew Lanham[/eluser]
Well i dont see any reason why the first one wouldn't work, as long as you have $hello set....on the second one using the codeigniter input class you don't need the isset, as if the POST variable is not set codeigniter would return false so you could try:

Code:
if($this->input->post("Ds_AuthorisationCode") == false){
   //Code here
}

#3
[eluser]webthink[/eluser]
because $this->input->post("Ds_AuthorisationCode") is a function where as $hello is a variable. isset looks in memory for a variable with the name you pass it as opposed to just the value.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.