php - Remove element from an array -


Hello I'm looking for some help in removing any element from an array. My array organizes incidents in each room, each room has its own array and each event has its own array within the cell array. I display the room id and the loop i loop through the loop and events of that room through the $ room and display their content. I would like to remove the array of events that have been displayed, so I do not have to spend time to compare the time of repeating the loop.

Below I am an example of the process that I am describing, I know that there is no point in destroying the element in this argument because I am using foreign, but in my application the function It requires a logic of ..

$ rooms

  array (3) {[1] = & gt; Array (2) {["Ridiculum"] = & gt; String (1) "1" ["Event"] = & gt; Array (0) {}} [2] = & gt; Array (2) {["Ridiculum"] = & gt; String (1) "2" ["Event"] = & gt; Array (0) {}} [3] = & gt; Array (2) {["Ridiculum"] = & gt; String (1) "3" ["Event"] = & gt; Array (2) {[0] = & gt; Array (7) {["lname"] = & gt; String (20) "xxxxxxxxxxxxxxxxxxxx"} [1] = & gt; Array (7) {["lname"] = & gt; Stroke (10) "yyyyyyyyy"}}}   

loop

  foreach ($ rooms $ as room) : Echo $ cell ['rid']; Foreign exchange ($ room ['event'] as $ event): Copy $ event ['lname'];   

If you can tell me that I should put the code inside foreach and how to see the code, it would really be great. I think it should be $ event ['lname'] right after the echo, but I can not figure out how to detect that element so that I can unset it. .

You can only unset this event later, resonating it, but you get it from $ room Need to be referenced, so that you need to use the key at every level. Try it:

  foreach ($ i = & gt; $ room $ room) {$ $ [['Rid' room echo]; $ Currency as $ foreign currency ($ $ [[event ']] $ event {ebb $ event [' lname ']; Not set ($ rooms [$ i] ['events'] [$ j]); }}   

You can see an example of how it works.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -