A plugin that adds that ability to insert any PHP code into a sidebar widget.
inPHP widget adds a new text widget that even allows PHP to be included! The text widget that comes with the default WordPress installation doesn't allow you to include PHP code in its text Widget but this plugin adds a new widget called 'inPHP Widget', which will allow you to include PHP code, as well as plain text and HTML.
Warning: This widget provides great flexibility in customizing your sidebar. It achieves this by automatically evaluating any included PHP included in the title or the body of the widget. Care should be taken when including PHP code in the sidebar, as with anywhere else in the WordPress system.