foreach and array need help combining


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

Hi guys.

Here's the code

Did you know?Explore Trending and Topic pages for more stories like this.
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]
No comments posted yet

Your Answer:

Login to answer
108 Like 51 Dislike
Previous forums Next forums
Other forums

first few characters only
hi, does anyone know how to use PHP to take the first few words of a text and limit them? i have see

Create or replace package is ending ORA-21700
Database 9.2.0., patch 8 (9.2.0.8.0).
I trying run
create or replace package ....etc.

Procedural to OOP
John Kleijn said that to avoid writing "crappy code", we should learn OOP and common OO pr

Code error with Index.php
Error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/runevid/public_

Ignore html and bbcode?
I've created a function to limit the amount of text according to the amount of words.

However

WORDPRESS - Multiple Loops Only Going to One Post?
I have various pages with multiple loops and i need them to be individual to all other categories.

Help? Need help on project with templates involving mysql and php.
I'm having a hard time explaining what I want but basically here is what I have in place:

-Da

adding up might be solved tell us cheers.
i think i finally solved this anybody.

last time i was getting the wrong results.

Code

Delete Client 066 Earlywatch
Hi all,

in former times client earlywatch was required for SAPs remote access to SAP inst

data type in column definition
Hi,
I create a table with column called "Direction of Travel code ".
The travel codes in t

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