For example, post name is 'New feature'. I need to get output Post name is New feature using eval()
$post = Post::find($id);
$str = 'Post name is $post->name';
eval("\$str = \"$str\";");
This code outputs Post name is {"id":1,"name": "New feature"}->name. How to get exactly name of post with eval, not whole object?
NOTE
do not pay big attention to what is outputs exactly, it was taken like abstract, i need to take attribute of object using eval, because $str will be dynamic
evalin this context is just an invitation to have arbitrary code execution on your serverevalis necessary