How to write the short code in WordPress php file?

sing do_shortcode() function inside of php tag. A very simple solution is to use the do_shortcode() function inside a PHP echo tag.

Shortcode is used in a WordPress post or page and text box widget and the php file.