The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

As you can see, I'm trying to get all the aswers into an array. But, when someone leave a field unanswered, then the array will contain a "". I'm trying to filter out all of the "", and strip all slaches as well.

array_pop() performs a very specific task and cannot be used in the way you have tried to

Arrays in PHP are a multi-talented animal. They are not just arrays in the strict sense of what an array is in C, C++ or Java for that matter. One way in which a PHP array can be used is as a stack. A stack is a collection (a.k.a data structure) that behaves in a very specific manner - you add elements to the top of the stack (known as pushing onto the stack) and remove elements from the top of the stack (known as popping elements). Think of a stack as a pile of dinner plates. You can only push a dinner plate onto the stack by placing it at the top of the stack. When you want to remove a dinner plate from the stack your only choice is to pop a plate from the top. Thus the first plate inserted into the stack will always be the last one popped out. This behaviour is fundamental to how computer programs work at a very low level (beyond my feable knowledge).

Anyway, that doesn't directly answer your question The only way I can think of doing what you want is to loop through the array as you do using foreach and copy the value accross to a new array IF it meets your conditions

My mistake DeNasio, if you want to preserve the array for later use after taking out the blank elements you will need to do as sid said and build a new array out of the non-blank elements. If all you were doing was printing them to the screen then this would have worked fine.