Jump to content
php.lv forumi

isset


goma smile

Recommended Posts

ir kaut kas tāds

private function ifExist($k){

return (isset($k) ? $k : NULL);

}

un tad kad arraya notiek

$kkas = $this->ifExist($value['kautkas']);

izmetās errors undeffined index vai kkas tāds nu tas kas parasti arraya izmetās ka tāda nav...

 

bet ja izmanto

$kkas = (isset($value['kautkas']) ? $value['kautkas'] : NULL);

tad viss iet...

 

Kas varētu būt pa vainu... ?

Edited by goma smile
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...