/    Sign up×
Community /Pin to ProfileBookmark

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/>”;
}
}
?>
[/code]

Please help.
I am really stuck.

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @jackgoddy123 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...