So much bad code arises from the fact that people don’t know that there’s a better way. If a developer doesn’t know about “split” and “join” functions, they might write a cumbersome for loop to manipulate a string. If they don’t know about regexes, they might really overcomplicate some string munging . Or heck, maybe they don’t understand a for loop, and use a while instead.

Maurycy submits this PHP code. It’s hard to really understand how this particular version of the code came into being.

while (substr($contentData->name,$pos,1)!=""){
    $letters[] = substr($contentData->name,$pos,1);
foreach ($letters as $key=>$letter){
    if (empty($matches)){
$contentName = implode($letters);
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!