doucai4274
2015-06-04 18:02
浏览 38
已采纳

使用特定要求重新排序阵列

I have an array that I need no reorder like this:

  • If this have "casa-cocina-mesas-" and "casa-cocina-mesas-somethingelse-", the value with more values must keep it, the other must be deleted.

  • But if we have this "casa-cocina-mesas-somethingelse-" and this "casa-anotherstuff-mesas-somethingelse-", the both must be saved.

  • And if an value have another differtent value like "electronic-tools" and "electronic-computer-accessory". bot array must be saved.

  • And i have some values as null too but this value doesn't matter.

  • Finally all the other must be removed.

    <?php
    $category = array("casa-cocina-",null,"casa-","electronic-computer-accessory","electronic-",null,"casa-cocina-mesas-",
    "casa-cocina-","electronic-","electronic-tools");
    ?>
    

图片转代码服务由CSDN问答提供 功能建议

我有一个数组,我不需要像这样重新排序:</ p>

    \ n
  • 如果这有“casa-cocina-mesas-”和“casa-cocina-mesas-somethingelse-”,则值必须保留更多值,另一个必须删除。</ p> < / li>

  • 但是如果我们有这个“casa-cocina-mesas-somethingelse-”和这个“casa-anotherstuff-mesas-somethingelse-”,那么两者都必须保存。</ p> < / li>

  • 如果某个值具有另一个不同的值,例如“electronic-tools”和“electronic-computer-accessory”。 必须保存bot数组。</ p> </ li>

  • 我也有一些值为null,但这个值无关紧要。</ p> </ li>

  • 最后必须删除所有其他的。</ p>

     &lt;?php 
     $ category = array(“casa-cocina  - ”,null,“casa-”  “电子计算机附件”, “电子 - ”,NULL, “住处-COCINA-台面 - ”,
     “个住处-COCINA  - ”, “电子 - ”, “电子工具”);吗?
    &GT  ; 
     </ code> </ pre> </ li> 
     </ ul> 
     </ div>

1条回答 默认 最新

相关推荐 更多相似问题