Jump to content

[SOLVED] Perform a function with every bit of data in an array


Dale_G

Recommended Posts

Hey everyone, quick question.

 

Alright, for example, let's say I have an array of random text.

 

$mytext = array( 'ololol', 'hilol', 'WTFBBQ', 'OMFGPWNISw##@234' );

 

Right? And I have a function that adds bold tags to text.

 

function bold_text( $text )
{
    return '<b>'.$text.'</b>';
}

 

Now, how can I apply the function to every item in the array of $mytext?

 

Yes I know I could just do it manually as I would only have to do it 4 times, but I have a more complicated use for this using an array that contains hundreds of items in the array.

 

So uh, thanks for the help fellow PHPers!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.