Skip to content
Advertisement

If isset function variable paramenters php

I have this function

JavaScript

The problem is that sometimes the variable Product $product doesn’t exist and this gives me an error.

I would like to do a kind of if isset and if it doesn’t exist just apply the $product variable

I’m new to programming I hope I don’t offend anyone with this question hehe To explain myself better, I would like it to look like this, any ideas?

JavaScript

I know that this cannot be done but more or less the idea is that

Advertisement

Answer

You can try to do this:

JavaScript

This simply means if the $product is not set, then it will be NULL.

Please check this link too.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement