mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-10-14 10:14:55 +02:00
market.php Performance improvement. Smarter queries and array referencing. Fix #264
This commit is contained in:
@@ -1,21 +1,4 @@
|
||||
<?php
|
||||
|
||||
function getItemNameById($id) {
|
||||
|
||||
$item_list = explode(PHP_EOL, file_get_contents('item_list.txt'));
|
||||
|
||||
foreach ($item_list as $items) {
|
||||
|
||||
$item_array = explode('@', $items);
|
||||
|
||||
if ($item_array[0] == $id) {
|
||||
|
||||
echo ucfirst($item_array[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Returns a PHP array $id => 'name'
|
||||
$items = getItemList();
|
||||
echo $items[2160]; // Returns 'Crystal Coin'
|
||||
@@ -28,22 +11,4 @@ function getItemList() {
|
||||
$ia[(int)$it[0]] = ucfirst($it[1]);
|
||||
}
|
||||
return $ia;
|
||||
}
|
||||
|
||||
function getItemIdByName($name) {
|
||||
|
||||
$item_list = explode(PHP_EOL, file_get_contents('item_list.txt'));
|
||||
|
||||
foreach ($item_list as $items) {
|
||||
|
||||
$item_array = explode('@', $items);
|
||||
|
||||
if ($item_array[1] == $name) {
|
||||
|
||||
echo ucfirst($item_array[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user