Jump to content

Recommended Posts

Perhaps a simple task...  I did ASP coding before, now I'm into PHP. So I'm a newbie in PHP.

 

2 arrays : $array1 = array("1","2","3","4");  and    $array2 = array("1","2");

 

In array2 you'll find the numbers that need to be excluded from array1.  So I should have als result  3 and 4.

 

I tried since 2 days now and can only check and exclude  1 number from array2  butnot dynamical !

 

$ii = 1;
foreach( $arrayLordervalue as $value )
{
  if( $value  == 1 )continue;


//komma's tussen de cijfers plaatsen
if($ii == 1){ $values[$ii] = $value;}
else { $values[$ii] = ",". $value;  }		
$value2= $value2.$values[$ii];
$ii++;   
} 

echo  $value2;     

 

Gives me 2,3,4. 

 

I'm completely stuck !

 

I tried foreach, for ($n...),while... bah what's left ? 

 

Link to comment
https://forums.phpfreaks.com/topic/262407-2-arrays-1-result-back/
Share on other sites

Well be damn..d !  PHP has seem to have so many functions,  I didn't thought to take a look at those functions !  Now I know it's in my own interest !  Thank you PFMaBiSmAd ! 

 

-> http://be2.php.net/manual/en/book.array.php  I'll use this site quiet often now !

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.