Jump to content

[solved] How to use a variable inside an expression?


ngrmm
 Share

Recommended Posts

Which syntax is need for this?
 

// field names: 
// field_1
// field_2
// field_3
// …

for ($i = 1; $i <= 40; $i++) {
	if($page->field_{$i} == 'test') { // this does not work 
		// do stuff
	}
}

 

Edited by ngrmm
solved
Link to comment
Share on other sites

  • ngrmm changed the title to [solved] How to use a variable inside an expression?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...