sivasakthi wrote:
Hi Guys,

I have a array like that below,

$values = ("name1 %we %tr ", "name2 %de.%ty %sd", "name3  %we 5te %mt/%
Hs");

another one array  like that,

$tmp = ("%tr", "%uy", "%xc");

I need to add the array of $tmp in to each element of array
$values.....Also i need to add the $tmp array in to after the name of
each element..
could you help me to find the solution..??


Thanks,


well, if I understand what you are asking to do, it should be as simple as this.


<?php

$values[] = "name1 %we %tr ";
$values[] = "name2 %de.%ty %sd";
$values[] = "name3  %we 5te %mt/% Hs";

$tmp[] = "%tr";
$tmp[] = "%uy";
$tmp[] = "%xc";

foreach ( $values AS $k => $v ) {
  if ( isset( $tmp[$k] ) ) {
    $values[$k] = $v . $tmp[$k]; // This puts it on the end
    $values[$k] = $tmp[$k] . $v; // This puts it at the start
  }
}

print_r($values);

?>

Hope this helps

Jim Lucas

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to