foreach and array need help combining


Posted on 16th Feb 2014 07:03 pm by admin

Hi guys.

Here's the code

Code: array(
'tag' => 'code',
'type' => 'unparsed_content',
'content' => '<div class="codeheader">' . $txt['smf238'] . ':</div><div class="code">' . ($context['browser']['is_gecko'] ? '<pre style="margin-top: 0; display: inline;">
$1</pre>' : '$1') . '</div>',
),

And what I want to do is explode $1 & add something to the end of it (a new variable.

eg.

Code: $1 - $2
So here's my explode code, I'm getting errors wherever I place it.

Code: $2 = '';
$codeChunks = explode("n", $1);

foreach($codeChunks as $i => $chunk)
{
$2 .= "$chunk - <b><a href='http://mysite.com?id=$chunk' target='_blank'>Hyperlink</a></b>n";
}

So hopefully I end up with an output like this ....

Code: 1 - [url=http://mysite.com?id=1]Hyperlink[/url]
2 - [url=http://mysite.com?id=2]Hyperlink[/url]
3 - [url=http://mysite.com?id=3]Hyperlink[/url]
4 - [url=http://mysite.com?id=4]Hyperlink[/url]
5 - [url=http://mysite.com?id=5]Hyperlink[/url]

108 Like 51 Dislike
Previous php-forum Next php-forum
Other php-forum

Progress bar tracking file downloads
Hey guys, was wondering if there was a way to track how far a file has been downloaded. I know there

Array to string conversion
Can anyone help me with this?

Notice: Array to string conversion in /home/..../index.php on l

replacements
I have a variable in my PHP script like

ASSFDDDDDDDDDDDDDASDDDDDDDDARYTRHKKHHHHHHHHHHH and p

Cannot Display Array from Select Statement + Login question
Hi,
I'm new to PHP but so far so goog. I was assigend a project and I'm very close to completion.

pull content
I have an existing page, domain/adverts.php which has a good PR. I've just rebuilt my site and the n

frames get header location..
i have two frames, one top, one bottom. how do i do a form on the bottom frame that gives me the ur

Google voice
I currently have a form in html, but I want it in php so the information is not in the source code.<

Save username into DB
OkaY so I got my blog to actually save the posts and whatever, all I need now is for it to keep the

SELECT * FROM users WHERE Users are not in Blocked
How do I select all users from users table where there users_id is not stored in the block table

php file erros / need help please
Hello

Someone decoded a zend file for me.. after uploaded it on ftp i get some errors, i trye

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash