Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET 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 22-Mar-13 14:12pm
Oubaha355
Comments
ThePhantomUpvoter at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 240
2 DamithSL 200
3 Raul Iloc 185
4 Richard MacCutchan 175
0 OriginalGriff 5,130
1 DamithSL 4,197
2 Maciej Los 3,670
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,821


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 22 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100