Click here to Skip to main content
16,017,264 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
PHP
<?php
$texte=$_POST['Req'];
$TGras=array();
preg_match_all("#<B>T(.)*?T</B>#",$texte,$TGras);
print_r($TGras[0]);
echo "<hr>";
$texte=preg_replace('/[,\.]/','',$texte);
$texte=trim($texte);
$tableau=preg_split("/( )+/",$texte);
echo $texte."<br>";
print_r($tableau."<br>");
$T=array();
$T2=array();
$total=count($tableau);
foreach($tableau as $e){
if(!key_exists($e,$T))
{
$T[$e]=1;
}else{
$T[$e]++;
}
}
$M=sizeof($tableau)/2;
for($i=0;$i<sizeof($tableau);$i++){
if(!key_exists($tableau[$i],$T2))
{
$T2[$tableau[$i]]=($i+1-$M)*($i+1-$M);
}else{
$T2[$tableau[$i]]=$T2[$tableau[$i]]+($i+1-$M)*($i+1-$M);
}
}
print_r($T);
print_r($T2);
echo "<Table border=1>";
echo "<tr><th>Mot</th><th>nbr occurences</th><th>distribution</th></tr>";
foreach(array_keys($T) as $e){
echo "<tr><td>$e</td><td>".round($T[$e]*100/$total,2)." %</td><td>".sqrt($T2[$e])."</td></tr>";
}
echo "</table>";
?>
Posted
Comments
[no name] 22-Mar-13 19:59pm    
Learning ASP.NET would be a good place to start. CodeProject is not a code translation service. You could go to www.vworker.com and hire someone to do this for you.

1 solution

I recently ran into the same situation. I know very little php, but I had to convert an entire website. White much of the php code is easy to read, there is no easy solution for direct conversion. This is because php is a scripting language while .NET is not.

From what I see in your code, you are programatically creating an HTML table and loading it with values. You can do the same thing in ASP.NET using DataGrids, DataReaders, etc. If you are trying to manually create the HTML table and populate it in .NET, you can always use Literals.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900