Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. Array
  2. (
  3. [0] => Array
  4. (
  5. [background] => https://example.com/image.jpg
  6. [description] => Example text
  7. [url] => https://example.com
  8. )
  9.  
  10. [1] => Array
  11. (
  12. [background] => https://example.com/image.jpg
  13. [description] => Example text
  14. [url] => https://example.com
  15. )
  16. )
  17.  
  18. $array = append_field($array, 'url', '?parameter=test');
  19.  
  20. function append_field($array, $field, $parameter)
  21. {
  22. foreach ($array as $inner_array) :
  23. foreach ($inner_array as $key => $append) :
  24. if ($key == $field) :
  25. $append .= $parameter;
  26. endif;
  27. endforeach;
  28. endforeach;
  29.  
  30. return $array;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement