“ Widget in wordpress will be more helpful for non-developer, widget can be create easily with simple steps. Widgets are the important advantage in wordpress, . Here is the tutorial for how to create widget in wordpress using php code.”

function freeze_plugin() – this function will create the widget name as “Freeze Widget”
function form() – this function will be used to display the content to Admin area 
function widget() – this function will be used to display the content to visitor area 
Add the below coding into your functions.php 

class freeze_plugin extends WP_Widget 
{
function freeze_plugin() 
{
parent::WP_Widget(false, $name = __(‘Freeze Widget’, ‘freeze_plugin’) );
}
function form()
{
echo “This is sample widget“;
}
function widget()
{
echo “This is sample widget“;
}
}
add_action(‘widgets_init’, create_function(”, ‘return register_widget(“freeze_plugin”);’));