WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to pass get_option value to an array value. This the value that I want to pass to the array.

<?php echo stripslashes(get_option('a')); ?>

and this is what I am trying to do.

<?php $var = array( 'foo' =>'echo stripslashes(get_option('a'));');

Please let me know how can I achieve this.

share|improve this question

closed as off topic by Michael, toscho Oct 8 '12 at 14:00

Questions on WordPress Development Stack Exchange are expected to relate to WordPress within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

This is about PHP syntax, not about something specific to WordPress. – toscho Oct 8 '12 at 14:01
up vote 2 down vote accepted

Use a simple variable to store the value.

 $a_val = stripslashes(get_option('a')); 
 $var = array( 'foo' => $a_val);
share|improve this answer
Thanks a lot Brian Fegter and deepa for you kind support. I'll really appreciate and will be thankful to you people if you please get some time and have a look at this question stackoverflow.com/questions/12751766/… and if you can answer, please do. – user1666698 Oct 8 '12 at 15:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.