Title: Not working function statement
Last modified: August 24, 2016

---

# Not working function statement

 *  [martin.maga](https://wordpress.org/support/users/martinmaga/)
 * (@martinmaga)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/not-working-function-statement/)
 * Hello
 * Thank you for awesome plugin to the wordpress. But I came up with the problem
   using this plugin. The problem is, whenever I want to to declare some function
   for example: [insert_php]
    $val = ‘hello’; function sayval($val) { echo “value
   is $val”; } sayval($val); [/insert_php] I will give me this error:”Fatal error:
   Cannot redeclare sayval() (previously declared in C:\Program Files (x86)\EasyPHP-
   DevServer-14.1VC9\data\localweb\wordpress_osada\wp-content\plugins\insert-php\
   insert_php.php(48) : eval()’d code:3) in C:\Program Files (x86)\EasyPHP-DevServer-
   14.1VC9\data\localweb\wordpress_osada\wp-content\plugins\insert-php\insert_php.
   php(48) : eval()’d code on line 6″. The solution that I found is that I just 
   remove the code from function and it works, but I am not able to use php function,
   which I need to use. I checked that I declared the function only once. Could 
   you please help me ? Thank you, Martin
 * [https://wordpress.org/plugins/insert-php/](https://wordpress.org/plugins/insert-php/)

Viewing 1 replies (of 1 total)

 *  [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * (@willbontrager)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/not-working-function-statement/#post-5979603)
 * Martin, perhaps the utilities you’re using somehow duplicate the PHP code. Try
   it on a test page of a live WordPress installation on the internet.
 * I say that because I had no problem with this:
 *     ```
       <hr>
       [insert_php]
       $val = 'hello';
       function sayval($val)
       {
       echo "value is $val";
       }
       sayval($val);
       [/insert_php]
       <hr>
       ```
   
 * (copied verbatim from my test page).
 * Will

Viewing 1 replies (of 1 total)

The topic ‘Not working function statement’ is closed to new replies.

 * ![](https://ps.w.org/insert-php/assets/icon-256x256.gif?rev=3523853)
 * [Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts](https://wordpress.org/plugins/insert-php/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-php/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-php/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-php/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-php/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-php/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/not-working-function-statement/#post-5979603)
 * Status: not resolved