php diziler trim kullanmak

0 Cevap php

Ben dizi şu var

Array ( [0] =>  [1] => Commodities [2] => Crude Oil [3] => 91.46 [4] => + 0.48% [5] => Natural Gas [6] => 4.54 [7] => + 0.38% [8] => Gasoline [9] => 2.49 [10] => + 0.49% [11] => Heating Oil [12] => 2.65 [13] => + 0.84% [14] => Gold [15] => 1368.07 [16] => + 0.40% [17] => Silver [18] => 28.78 [19] => + 1.62% [20] => Copper [21] => 4.41 [22] => + 0.14% [23] => Quotes delayed 15 min. [24] => » Add to your site )

i gibi bir dizi istiyorum

Array([0]=>Array
(name => Crude oil
price => 91.46
precent => +0.48)
[1]=>Array
(name => Natural Gas
...
..
and so on upto Copper
)

i kullanarak çalıştı

for ($i = 2; $i <6 ; $i = $i +3) {
   $commoditiesdatagot[] = array (
   trim($arraymain[$i]),
   trim($arraymain[$i +1]),
   trim($arraymain[$i +2])
   );
  }

ama şu hatayı almaya devam -

PHP Warning:  Module 'mcrypt' already loaded in Unknown on line 0
PHP Notice:  Undefined offset:  25 in /var/www/html/iphorex/live/commodities.php on line 51

Notice: Undefined offset:  25 in /var/www/html/iphorex/live/commodities.php on line 51
PHP Notice:  Undefined offset:  26 in /var/www/html/iphorex/live/commodities.php on line 49

Notice: Undefined offset:  26 in /var/www/html/iphorex/live/commodities.php on line 49
PHP Notice:  Undefined offset:  27 in /var/www/html/iphorex/live/commodities.php on line 50

line 51 nerede trim($arraymain[$i +2]).

Herhangi bir yardım ..........

0 Cevap