1

This is my output Arrays:

    Array
    (    
    [0] =>     
    [1] =>     
    [2] =>     
    [3] =>     
    [4] =>     
    [5] =>     
    [6] =>     
    [7] => 200    
    [8] => 200
    )

But I need only: [7] => 200
[8] => 200

Any idea?

4
  • 5
    array_filter($your_array) Commented Jan 7, 2016 at 6:03
  • 1
    print_r(array_filter($your_array)); Commented Jan 7, 2016 at 6:04
  • 2
    Can you please place your code with question? Commented Jan 7, 2016 at 6:04
  • 1
    check this php.net/manual/en/function.array-filter.php Commented Jan 7, 2016 at 6:04

2 Answers 2

1

Use array_filter():

For example,

$a= array
(    
 0 => '',    
 1 => '',   
 2 => '',  
 3 => '', 
 4 => '',
 5 => '',
 6 => '',
 7 => 200,  
 8 => 200,
);

print_r(array_filter($a));
Sign up to request clarification or add additional context in comments.

Comments

0

You can do it as:

print_r(array_filter($Array));

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.