Array Value Removal

    Date: 07/12/05 (PHP Community)    Keywords: php

    Hey there,

    Quick question. I'm trying to create something akin to a deck of cards, where an item is removed from an array through a random value. This stops being a factor in future selections until it is repopulated.

    The problem is that after scouring my PHP manual, I can't see a thing about this specifically. I probably missed something, which is why I want to see if there are options that you are aware of.

    This is what I have so far;

    $test = array('1','2','3','4','5');

    $testFront = array_slice($test, 0, 2);
    $testEnd = array_slice($test, 3, count($test));

    foreach ($testFront as $key => $value) { $testResult[] = $value; }
    foreach ($testEnd as $key => $value) { $testResult[] = $value; }

    ?>


    Any suggestions or hints?

    Source: http://www.livejournal.com/community/php/317902.html

« Firefox Adblock Filter... || Help creating a query »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home