NotionCommotion Posted January 13, 2017 Share Posted January 13, 2017 What could cause this error? dm('count: '.isset($rsp['data'])?count($rsp['data']):0); // /var/www/src/ClientApp.php line 83 OUTPUT: Undefined index: data in /var/www/src/ClientApp.php on line 83 Quote Link to comment https://forums.phpfreaks.com/topic/302922-how-can-an-index-be-set-and-undefined-at-the-same-time/ Share on other sites More sharing options...
Solution mac_gyver Posted January 13, 2017 Solution Share Posted January 13, 2017 the error is because you are concatenating the string 'count: ' with the isset() expression, which will always be true. you need to put () around the trinary statement so that it is evaluated as an expression that then gets concatenated with that string. Quote Link to comment https://forums.phpfreaks.com/topic/302922-how-can-an-index-be-set-and-undefined-at-the-same-time/#findComment-1541343 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.