<?php
// Assuming data coming from database is in 1 row.
$data = array
(
'table_nightclub_1' => 'Y',
'table_nightclub_2' => 'N',
'table_nightclub_3' => 'N',
'table_nightclub_4' => 'Y',
'table_nightclub_5' => 'N',
'table_nightclub_6' => 'N',
'table_nightclub_7' => 'Y',
'table_nightclub_8' => 'N',
'table_nightclub_9' => 'N',
'table_nightclub_10' => 'Y',
);
function Step1($value)
{
return 'N' != $value;
}
function Step3($value)
{
return substr($value, strlen('table_nightclub_'));
}
echo
implode // Step 4 : Implode them.
(
' / ',
array_map // Step 3 : Drop the textual part of the keys.
(
'Step3',
array_keys // Step 2 : Get the keys from the remaining 'Y's.
(
array_filter // Step 1 : Remove 'N's from array.
(
$data,
'Step1'
)
)
)
);
|