Re: [nyphp-talk] Removing one element from an array

2007-07-09 Thread Dell Sala
On Jul 9, 2007, at 10:22 PM, David Krings wrote: Cliff Hirsch wrote: Look at array_slice Based on the vote tally array_slice won, but I don't get this command. I just went for broke and tried my unset suspicion and indeed it works. Your solution seems fine to me. You just save a couple

Re: [nyphp-talk] Removing one element from an array

2007-07-09 Thread David Krings
Cliff Hirsch wrote: Look at array_slice Based on the vote tally array_slice won, but I don't get this command. I just went for broke and tried my unset suspicion and indeed it works. This is the scenario: I have abunch of record IDs in an array, which I stuffed into the $_SESSION variable. T

Re: [nyphp-talk] Removing one element from an array

2007-07-09 Thread Cliff Hirsch
Look at array_slice ___ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.ph

Re: [nyphp-talk] Removing one element from an array

2007-07-09 Thread Jon Baer
Hmmm (not sure why Im always trying to compact stuff to one line now) ... $array = array(1,2,3,3,3,3,4,5); $remove = 3; while (in_array($remove, $array)) unset($array[array_search($remove, $array)]); print_r(array_values($array)); - Jon On Jul 9, 2007, at 8:16 PM, David Krings wrote: Hi!

Re: [nyphp-talk] Removing one element from an array

2007-07-09 Thread Graham Hagger
Hi David, Ran into this myself a short time ago. There's probably a better answer, but I ended using array_diff. Basically I pass in the original array, and a new single element array containing the element to remove, and pocket the difference. To (kinda) rewrite the manual/online help fo

Re: [nyphp-talk] Removing one element from an array

2007-07-09 Thread Dell Sala
take a look at array_splice() -- Dell On Jul 9, 2007, at 8:16 PM, David Krings wrote: Hi! I have an array with numerical keys. I need to remove one element of the array and then rekey the array to have consecutive keys again. I got the rekeying down, but how do I pop off an array eleme

[nyphp-talk] Removing one element from an array

2007-07-09 Thread David Krings
Hi! I have an array with numerical keys. I need to remove one element of the array and then rekey the array to have consecutive keys again. I got the rekeying down, but how do I pop off an array element in the middle of an array? Is that done using unset($array[123]) ? I'm having a deer-stari

Re: [nyphp-talk] Questions to ask at a job interview?

2007-07-09 Thread inforequest
P. Ju (朱漢璇) pjlists-at-pobox.com |nyphp dev/internal group use| wrote: Hello all, I'm new to this list but not to PHP. I've been architecting and developing Web applications and networked software products for about 17 years and have had the good fortune to work for some very interesting client

Re: [nyphp-talk] Questions to ask at a job interview?

2007-07-09 Thread inforequest
Rudy rudy-at-taytek.com |nyphp dev/internal group use| wrote: Wow that was a blast from my past. Now using the stack is kind of like using a helper variable but all us Forth programmers know that the stack is much more efficient. Oh yeah not to mention using RPN. I still use my 20+ year-ol

Re: [nyphp-talk] Questions to ask at a job interview?

2007-07-09 Thread Rudy
Wow that was a blast from my past. Now using the stack is kind of like using a helper variable but all us Forth programmers know that the stack is much more efficient. Oh yeah not to mention using RPN. I still use my 20+ year-old HP 15C calculator and find it extremely difficult to use a non

Re: [nyphp-talk] Questions to ask at a job interview?

2007-07-09 Thread Steve Manes
A ! B ! B @ A @ Nobody said you couldn't use Forth... ($a, $b) = ($b, $a); ... or Perl ___ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your P

Re: [nyphp-talk] Questions to ask at a job interview?

2007-07-09 Thread Chris Shiflett
Steve Manes wrote: > A ! B ! B @ A @ > > Nobody said you couldn't use Forth... > > ($a, $b) = ($b, $a); > > ... or Perl But this is a PHP list. :-) list($a, $b) = array($b, $a); Chris -- Chris Shiflett http://shiflett.org/ ___ New York PHP Commun

Re: [nyphp-talk] Questions to ask at a job interview?

2007-07-09 Thread Brian Dailey
That would only work if the variable were an integer. If I remember correctly, the variable type was unspecified. ;-) - Brian Chris Shiflett wrote: Your first instinct, make a copy and then reassign the values, is a straightforward way to do it. I agree that using xor isn't a very straightfo