Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
This is about PHP syntax, not about something specific to WordPress. – toscho Oct 8 '12 at 14:01

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

Questions on WordPress Answers are expected to relate to WordPress within the scope defined in the FAQ. 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 closed questions here.

1 Answer

up vote 0 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.