How to save each array values in next line?

by Suraj   Last Updated December 14, 2017 14:07 PM

I am having a requirement that, automating the contributed module configurations via hook_update. I have a text area, where i need to mention different URLs with one URL/line. For reference look into the image:

enter image description here

To achieve this I have to use variable_set(); function. I tried something like below but not able to get all the values displayed.

$test = array('abc/*','xyz/*','ijk/*');
variable_set('boost_testing', $test);

This code is setting only first row, it will not come to next row.

So please suggest something I can do by using <br> or \n so that i can display each values next row. Any help will be appreciated.

Answers 1

You should pass paths as a string instead of array:

$test = "abc/*\nxyz/*\nijk/*\n";
variable_set('boost_testing', $test);

Remember to use double quotes for the $test string.

Vishal Patil
Vishal Patil
December 14, 2017 13:36 PM

Related Questions

How to set value for select list in hook_update?

Updated December 14, 2017 07:07 AM

Boost, not caching - Drupal 7

Updated June 06, 2015 22:03 PM

Site indexed with cache folder

Updated June 06, 2017 23:07 PM