<?php
function PalindromeLengthPuzzle($input1)
{
$polin_array =array();
foreach ($input1 as $key => $value) {
$res[]= substr($value,0,1);
}
print_r($res);
for($c=0;$c<=1000;$c++):
shuffle($res);
$result= implode('',$res);
if($result==strrev($result)){
$polin_array[]=$result;
}
endfor;
$polin_array=array_unique($polin_array);
print_r($polin_array);
foreach ($polin_array as $key => $value) {
$val =strlen($value);
}
echo $val;
}
echo PalindromeLengthPuzzle(array('Bharti', 'Bharat','Brijesh','Bhavna','Anjit','Chand','Aushil'));
?>
function PalindromeLengthPuzzle($input1)
{
$polin_array =array();
foreach ($input1 as $key => $value) {
$res[]= substr($value,0,1);
}
print_r($res);
for($c=0;$c<=1000;$c++):
shuffle($res);
$result= implode('',$res);
if($result==strrev($result)){
$polin_array[]=$result;
}
endfor;
$polin_array=array_unique($polin_array);
print_r($polin_array);
foreach ($polin_array as $key => $value) {
$val =strlen($value);
}
echo $val;
}
echo PalindromeLengthPuzzle(array('Bharti', 'Bharat','Brijesh','Bhavna','Anjit','Chand','Aushil'));
?>