Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Variable Variable

I am trying to find out if Phalcon supports variable variables or dynamic evaluation? The code below shows the basic sof what I am trying to do.

//This sets $story_prefix to "home"

$story_prefix =     lower($story["story_name"]);    

// This is the desired end result. Setting the view variable home_title to the returned firld from the database loop. 

// The word home below would actually be the $story_prefix variable from above.



Got it! Below for those interested.

$story_variable = $this->story_prefix."_title";

$this->view->$story_variable = $story["story_title"];