Advertisement:

Adding an argument in the middle of an array

Aloittaja Biology Forums, lokakuu 17, 2013, 04:40:04 IP

« edellinen - seuraava »

Biology Forums

So here's the array:

array(
'tag' => 'img',
'type' => 'unparsed_content',
'content' => '<img src="$1" alt="" border="0" />',


I've like to add an argument like:

<img src="$1" IF(SOMETHING) DO SOMETHING ELSE DO SOMETHING alt="" border="0" />',

How do I add a PHP argument like that?

Arantor

You can't just blindly do that. We need *specifics* to help you with this because otherwise it's going to mess up (guaranteed, owing to inline ternary vs concatenation operator precedence)
Holder of controversial views, all of which my own.


Biology Forums

Lainaus käyttäjältä: Arantor - lokakuu 17, 2013, 04:41:22 IP
You can't just blindly do that. We need *specifics* to help you with this because otherwise it's going to mess up (guaranteed, owing to inline ternary vs concatenation operator precedence)

I've made backups in case it breaks. Any suggestions? I really want to learn this.

It's nothing specific, I just took that code randomly from subs.php...

Arantor

My suggestion is that I NEED you to be specific because you're going to be doing things like:

'content' => '<img src="$1"' . (some expression ? first value : second value) . ' alt="" border="0" />',
Holder of controversial views, all of which my own.


Biology Forums


Advertisement: