Hello, I created variables to get the value of my get_sub_field() inside the get_row_layout() and I have encountered an issue. I can still access the variables even I’m not inside in the get_row_layout() or even outside of the while loop. I just created the variable inside the get_row_layout() but I can still access and output the value. I expected that it will have an error like “unexpected variable”.
PHP does not work like this. The if statement is true so $title is assigned a value. This value is this variable is available anywhere in the same scope of PHP after is is assigned… anywhere in the same file, unless you change the variables value.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users