1

I have a range of fourier transform values in php as shown below.

[8974,398.22605659378,340.40931712583,224.61805748557,224.21476160103,531.02102311671,348.09311299013,74.373164045484,440.15451832283,379.54095616825,801.05398080895,184.15175862698,539.59590498835,114.82864261836,595.84662567888,488.12623039438,370,488.12623039438,595.84662567888,114.82864261836,539.59590498835,184.15175862698,801.05398080895,379.54095616825,440.15451832283,74.373164045484,348.09311299013,531.02102311671,224.21476160103,224.61805748557,340.40931712582,398.22605659378]

How do I actually ignore/delete away the first value in this case "8974" in php language?

Muhammad Zeeshan
  • 8,722
  • 10
  • 45
  • 55
ActiveUser
  • 39
  • 2
  • 5

4 Answers4

0

Ignore it

Create a temporary array from the first by skipping the first element:

foreach (array_slice($arr, 1) as $xyz) {
   /// ...
}

Or, without creating a temporary array:

reset($arr); next($arr); // reset and skip first element
while (list($key, $value) = each($arr)) {
    echo $value;
}

Modify it

Modify the array in place by shifting the first item off:

array_shift($arr);
// do whatever you want
Ja͢ck
  • 170,779
  • 38
  • 263
  • 309
0

You can use array_shift();

Like

    $array=array(8974,398.22605659378,340.40931712583,224.61805748557,224.21476160103,531.02102311671,348.09311299013,74.373164045484,440.15451832283,379.54095616825,801.05398080895,184.15175862698,539.59590498835,114.82864261836,595.84662567888,488.12623039438,370,488.12623039438,595.84662567888,114.82864261836,539.59590498835,184.15175862698,801.05398080895,379.54095616825,440.15451832283,74.373164045484,348.09311299013,531.02102311671,224.21476160103,224.61805748557,340.40931712582,398.22605659378);
array_shift($array);
print_r($array);
0

You could use array_shift

ie:

 $myArray = array(8974,398.22605659378,340.40931712583,224.61805748557,224.21476160103,531.02102311671,348.09311299013,74.373164045484,440.15451832283,379.54095616825,801.05398080895,184.15175862698,539.59590498835,114.82864261836,595.84662567888,488.12623039438,370,488.12623039438,595.84662567888,114.82864261836,539.59590498835,184.15175862698,801.05398080895,379.54095616825,440.15451832283,74.373164045484,348.09311299013,531.02102311671,224.21476160103,224.61805748557,340.40931712582,398.22605659378);
 array_shift($myArray)
gturri
  • 13,807
  • 9
  • 40
  • 57
0

You can easily unset first element to Delete it:

unset($array[0]);
Alireza
  • 1,428
  • 4
  • 21
  • 33