josiahwiebe
josiahwiebe

Reputation: 151

Call a variable within an array

I currently have a variable setup in one php file:

<?php
$images_url = "http://foo.bar.com/helloworld/images/";
?>

I have a different file in which I have an array. Here's a snippet of the array:

'image'   => '<img src="urlencode($images_url);/news/20140528.jpg" />';

I'm guessing urlencode() is not the correct tool, but it's the most recent one I've tried.

PS. Please excuse any formatting issues, as this was composed on my phone.

Upvotes: 1

Views: 56

Answers (2)

MD Singh
MD Singh

Reputation: 1455

try this

 'image' => '<img src="' . urlencode($images_url) . '/news/20140528.jpg" />';

Upvotes: 0

chiwangc
chiwangc

Reputation: 3577

Try the following instead:

'image' => '<img src="' . urlencode($images_url) . '/news/20140528.jpg" />'

Upvotes: 1

Related Questions