简体   繁体   中英

Simple syntax help for an IF statement

Hello I have a foreach loop that assigns values to the following code

${'varimages' . $image_count} = $images;

// outputs for image_count = 1, $varimages1 = a string

However, I want to make an IF statement to check something. The "correct" form should be below but I have errors for the presence of " { " and " } "

if (${'varimages' . $image_count} == ${'vartitle' . $image_count}) 
{ echo "ok"; } else { echo "not ok"; }

How can I rewrite that statement correctly? Thank u!

使用数组,它将是:

if($varimages[$image_count] == $vartitle[$image_count])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM