WebDNA vs. PHP

The best way to show the difference between the two languages is to compare the code required to do the same thing. Even a non-techie can see what's going on in the WebDNA example.

Do you want a directory file listing, with files and only files, showing png and swf files only, hiding other files and hiding file extension? There's a simple beauty in typing:
[listfiles path=./][showif [isfile]=T]
[if ("[fileName]" ^ ".png")|("[filename]" ^ ".swf")]
[then]
[grep search=\..*&replace=][filename][/grep]<br>
[/then]
[/if][/showif][/listfiles]


as opposed to unintuitive PHP code:

<?php
functionstrip_ext($name){
$ext=strrchr($name,'.');
if($ext!==false){
$name=substr($name,0,-strlen($ext));
}
return $name;
}
function removeHyphen($filename) {
$target = $filename;
$patterns[0] = '/-/';
$patterns[1] = '/_/';
$replacements[0] = ' ';
$replacements[1] = ' ';
$filename = preg_replace($patterns, $replacements, $target);
return $filename;
}
function capFirstWord($word) {
$cap = $word;
$cap = explode(' ', $cap);
foreach($cap as $key => $value) {
$cap[$key] = ucfirst($cap[$key]);
}
$word = implode(' ', $cap);
return $word;
}
function formatFile($name) {
$name = strip_ext($name);
$name = removeHyphen($name);
$name = capFirstWord($name);
return $name;
}
$mydir = dir('./');
$extension_blacklist = array("gif", "js", "css");
$filter = array("config.php", "printpage.php");
while (($file = $mydir->read()) !== false)
{
$file_info = pathinfo($file);
if ($file != "." && $file != ".." && !in_array($file, $filter) && !in_array($file_info['extension'], $extension_blacklist))
if(!is_dir($file))
{
echo "<li><a href='./$file'>".formatFile($file)."</a></li>";
}
}
$mydir->close();
?>


Here another PHP vs. WebDNA example. Christophe Billiottet

DOWNLOAD WEBDNA NOW!

Top Articles:

Support

The support team and an experienced base of programmers is always available to you...

Large companies using WebDNA

Large companies have been using WebDNA for years: speed and robustness as well as scalability have been some of the most attractive strengths of this language...

More than just websites

WebDNA is a great all-purpose language for adding dynamic elements to websites...

WebDNA Hosting Companies

WebDNA Hosting Companies...

Unifying the syntax

I seem to have the hardest time describing WebDNA to smart people...

WebDNA database access and the future of SQL

WebDNA databases vs SQL databases...

Related Readings:

WebDNA vs. PHP

The best way to show the difference between the two languages is to compare the code required to do the same thing...

A revolutionary database system...

I think it's really important to point out how a RAM-centric data engine is far more powerful and appropriate than all of the disk-centric database programs on the market...