I just started learning php and would like to know how to create valid words using the letters "q w e r t y u i o p", which is the top row of the keyboard. I believe I need to use preg_match, yet not sure how to. Could some one help please? ;)

You can use this script. Once run this code you can get the words.
If you have any doubts in code let me know.

<?
$arr=array("asjfhjdshfj","put","yet","up","type","kdfjhkfdh","sdjkhgjdfhgj","jashdfjsgf","sjdfjsdgf");
$i="qwertyuiop";
$k="";
$p=0;
$g=0;
$s=array();
while($p<=count($arr))
{
for($o=0;$o<strlen($arr[$p]);$o++)
{
for($j=0;$j<strlen($i);$j++)
{
$l=$arr[$p];
if($l[$o]==$i[$j])
{


$k.=$i[$j];
$g++;
}
if($g==strlen($arr[$p]))
{
$s[]=$k;
$k="";
$g=0;
}
}
}
$p++;
}
print_r($s);
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.