Welcome Guest, Not a member yet? Register   Sign In
Explanation of $var->{'anything'}
#1

[eluser]Total Shop UK[/eluser]
Hey,

Hopefully someone could explain how $var->{'anything'} works?

The problem I have is with the code below:-

Code:
$json=json_decode(stripslashes($this->input->post('_gt_json')));
if ($json->{'action'} == 'save'){

If there are errors in the data passed I get the message below

Code:
Message: Trying to get property of non-object

I am unsure how I should check the data so the error does not appear?

Normally I use the below depending on what I'm checking but I've never used $var->{'anything'} before!?

Code:
!empty($var)
$var!=''
is_array($var)

Any help would be much appreciated,

Thanks,
totalshopuk
#2

[eluser]Total Shop UK[/eluser]
Fixed using
Code:
!is_null()




Theme © iAndrew 2016 - Forum software by © MyBB