Not sure why this is in general web building, this is a PHP error.
This code passes a lint test (as well as visual :P). Your problem is elsewhere. Is this code from functions.php?
Edit:
Oh wait you were changing things so there are two possible errors.
The first one is clear, there is no function called dynamic_sidebar in scope to work with. Maybe your missing an include?
The second one could be caused by having an open string prior to the error. We can't verify that since you don't have enough code.