これらの名前などを含む配列の変数があります。
// Listing ENTITIES
$entitiesTable = array(
1 => "user",
2 => "group",
3 => "customer",
4 => "supplier",
5 => "terminal",
6 => "order",
7 => "invoice",
8 => "invoice detail",
9 => "invoice offer",
10 => "invoice offer detail",
11 => "quotation",
12 => "quotation detail",
13 => "quotation offer",
14 => "quotation offer detail",
15 => "purchase order",
16 => "purchase order detail",
17 => "purchase order request",
18 => "purchase order request detail",
19 => "sales order",
20 => "sales order detail",
21 => "delivery order",
22 => "delivery order detail",
23 => "sales return",
24 => "sales return detail",
25 => "purchase return",
26 => "purchase return detail",
27 => "item",
28 => "category",
29 => "unit measurement",
30 => "last activity",
31 => "rack",
32 => "alert",
33 => "filter",
34 => "prefix code",
35 => "system",
36 => "company profile"
);
PHP 本体の途中で、For ループを作成します。配列を反復し、em をエコーします。
foreach ($entitiesTable as $singleEntity){
if(preg_match($regexUsed, $singleEntity)){
$pluralEntity = preg_replace($regexUsed, 'ies', $singleEntity);
} else {
$pluralEntity = $singleEntity . 's';
}
// Replacing spaces with a dash character and capitalize the first word
$pluralEntityWOSpace = ucwords($pluralEntity);
$pluralEntityWOSpace = str_ireplace(" ","" , $pluralEntityWOSpace);
$pluralEntityWDash = str_ireplace(" ","-" , $pluralEntity);
$singleEntityWOSpace = ucwords($singleEntity);
$singleEntityWOSpace = str_ireplace(" ","" , $singleEntityWOSpace);
echo $singleEntityWOSpace . '<br/>';
}
どういうわけか、配列から以前にリストされているように、取得したものは完全な名前ではないことに今気づきました。代わりに、私が今得たのはそれらの名前のほんの一部です。見て!取得した出力名は次のとおりです。
User
Group
Customer
Supplier
Terminal
Order
Invoice
InvoiceDetail
InvoiceOffer
InvoiceOfferDetail
Quotation
QuotationDetail
QuotationOffer
QuotationOfferDetail
PurchaseOrder
PurchaseOrderDetail
PurchaseOrderRequest
PurchaseOrderRequestDetail
SalesOrder
SalesOrderDetail
DeliveryOrder
DeliveryOrderDetail
SalesReturn
SalesReturnDetail
PurchaseReturn
PurchaseReturnDetail
Item
Category
UnitMeasurement
LastActivit
PHPスクリプトの最後にFLUSH()を書き込もうとしましたが、それらの名前の出力は問題ありません。しかし、Slim Frameworkを使用しているため、別のエラーが表示されます。FLUSH()を使用する代わりに別の方法はありますか?