Hello,
I am working on the logic code which returns the values proper as needed combining 1,2,3 arrays.
But it gives result as combining first two results as well which is not required.
I want if $slice contains “ers” at end so $suffix should not add. for which I have used the regex code.
But it prints onlyy array $slice and $array3 in middle of the output as eg: “Biggest Web Development” ,
“Leading Web Development” , “Best Web Development” as so on after every 9 row.
code:
[code=php]
<?php
$slice = array(0=>”Web Development”, 1=>”Online Marketing”, 2=>”Australian Web Developers”, 3=>”Web Designs”, 4=>”Custom Web Design”, 5=>”Online Marketing”,6=>”Internet Advertising”,7=>”Professional Web Design”,8=>”Web Designing”);
$array3 = array(0=>”Biggest”, 1=>”Leading”, 2=>”Best”, 3=>”Top”, 4=>”Largest”, 5=>”Premier”);
$suffix = array(0=>”Agency”, 1=>”Provider”, 2=>”Service”, 3=>”Specialist”, 4=>”Experts”, 5=>”Company”, 6=>”Business”, 7=>”Builder”, 8=>”Services”);
foreach($slice as $slices =>$value)//keywords
{
foreach($array3 as $array3_keys =>$array3_value)//superlatives
{
foreach($suffix as $suffix_keys =>$suffix_value)// suffixs
{
if((!preg_match(“/ers$/”,$value, $matches)))
{
echo $array3_value.” “.$value.” “.$suffix_value.”<br/>”;
}
}
echo $array3_value.” “.$value.”<br/>”;
}
}
?>
Please help.
I am really stuck.