How to add PHP code to your side bar widget in WordPress

First install this plugin : PHP Code Widget from here

Once installed, you will now see a new widget by the name of “PHP Code” in your Appearance >> Widgets , like seen below.

Now simply drag and use this widget like any other normal widget, and type in your php code and preview it.

Cheers !