T.Todua
T.Todua

Reputation: 56487

Set and then use variable inside IF statement?

Is there any difference between how PHP versions parse this (or will that make any issue somewhere), if I use such line:

if ( file_exists($x="myfile") && include($x) ) 
{
.....

are there any case when $x might not be set in include ?

Upvotes: 0

Views: 59

Answers (1)

Efekan
Efekan

Reputation: 1505

On every version of PHP that will work (Except maybe for php versions older than 4.4).

I've tested this out with the sandbox from onlinephpfunctions.

Upvotes: 1

Related Questions