Switch case is showing unexpected behaviour in php
<p>I have a file called english.php 
It looks like this:</p>

<pre><code>$lang = array();
$lang['date40a']="ABCSDMKOK";
$lang['date40b']="ABCSDMKOK";
$lang['date287']="ABCSDMKOK";
</code></pre>

<p>A file called gujarati.php and hindi.php which also is the same as english.php.</p>

<p>A file which finds differnce of current date and date in database and according to switch case selects apprpriate value:it looks like:</p>

<pre><code>&lt;?php
require_once ("config.inc.php");//does connection with mysql
$result1 = mysql_query("SELECT  `Mobileno` , `Lang` , `DOB_baby` FROM  ` registration`");
while ($row = mysql_fetch_array($result1))
{
 $lang = $row['Lang'];
 $beginDate = $row['DOB_baby'];

  $beginDate = $row['DOB_baby'];
  $endDate = date("Y-m-d");
  $endTimestamp = strtotime($endDate);
  $beginTimestamp = strtotime($beginDate);
  $datediff = abs($endTimestamp - $beginTimestamp) / 86400;
  $datediff = intval($datediff);
  require_once ($lang.'php');
  switch ($datediff)
  {
  case 40:
  $messagetext1 = $lang['date40a'];
  $messagetext2 = $lang['date40b'];      
  break;
  case 287:
  $messagetext1 = $lang['date287'];
      break;
  }
   $xyz = $lang['date287'];
    echo $xyz;
    if (isset($messagetext1))
      echo $messagetext1;
   }

  ?&gt;
</code></pre>

<p>Now OUTPUT when datediff is 287 or anyother date which matches....
ABCSDMKOK
e</p>

<p>or </p>

<p>ABCSDMKOK
e</p>

<p>or </p>

<p>ABCSDMKOK
h</p>

<p>if language was english/hindi/gujarati respectively
This occured many times 
sometimes it workes fine other times it doesnot..can anyone tell me what is the issue??
my english.php and other laguage files are longer..i have just shown a part of twhat the entire file looks like..and also switch case contains about 20 cases.
Please HELP!</p>
