Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> test skryptu
Ruio
post 2.10.2010, 14:50:51
Post #1





Grupa: Zarejestrowani
Postów: 147
Pomógł: 9
Dołączył: 20.02.2009

Ostrzeżenie: (0%)
-----


Mam pytanie. Jakim narzędziem sprawdzać szybkość skryptu (ile mozna pisać microtime na początku i na końcu haha.gif )? I pytanie nr. 2 mam taki oto kod:

  1. $production[1] = (($this -> last_update() * ($this -> production_data[1] / 3600)) * $this -> production_speed);
  2. $production[2] = (($this -> last_update() * ($this -> production_data[2] / 3600)) * $this -> production_speed);
  3. $production[3] = (($this -> last_update() * ($this -> production_data[3] / 3600)) * $this -> production_speed);
  4. $production[4] = (($this -> last_update() * ($this -> production_data[4] / 3600)) * $this -> production_speed);
  5. $production[20] = (($this -> last_update() * ($this -> production_data[20] / 3600)) * $this -> production_speed);
  6. $production[312] = (($this -> last_update() * ($this -> production_data[312] / 3600)) * $this -> production_speed);


Lepiej jest go zapisać tak jak zrobiłem to ja w przykładzie 1 czy też użyć pętli foreach ? e.g.

  1. $a = array(1,2,3,4,20,312);
  2.  
  3. foreach($a as $id){
  4. $production[$id] = (($this -> last_update() * ($this -> production_data[$id] / 3600)) * $this -> production_speed)
  5. }
  6.  
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 20.06.2025 - 05:19