Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Simply need to replace terms that are in array :

<?php

$listarray = array('#TERM1#' => 'value term 1', '#TERM2' => 'value term 2');
$i=0;

foreach( $listarray as $handle ){
$i++;
$handle = str_replace($handle[$i][0], $handle[$i][1], $handle);
}

echo $handle;


?>

Would like to have : handle with #TERM1# = value term 1 and #TERM2# = value term 2

share|improve this question
 
and what have you tried? –  hek2mgl 7 hours ago
 
I tried that code but errno = Fatal error: Cannot use string offset as an array in if( !empty( $arrayreplace ) ){ foreach( $arrayreplace as $valout ){ $handle = str_replace($valout[$i][0], $valout[$i][1], $handle); // var_dump( $valout ).'...'; } } var_dump( $handle ); –  Titus 7 hours ago
 
Your code makes no sense. $handle is a string, not an array, so what is $handle[$i][0] supposed to be? –  Barmar 7 hours ago
 
@Titus Learn PHP! You'll find tons of documents out there about that. If you need a personal teacher you may hire me –  hek2mgl 7 hours ago
 
I looked on php.net and infos about array but none about double dim –  Titus 7 hours ago
show 4 more comments

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.