I constantly find myself if such statements look like this:
if(isset($this->request->data['Parent']['child'])){ $new_var['child'] = $this->request->data['Parent']['child']; }
My question is that without creating a new shorter variable before the if there a magical php process that can help avoid overwriting $this->request->data['Parent']['child'] in the body of the if statement? I also want the code to be clean for any successor developers.
I am also not looking for a triple solution. Something else a bit along the line of using jquery this . (What I know) php does not allow anonymous functions, or it is not a common practice, and I am not saying that I need a bunch of anonymous functions for all my classes.
source share