<?php
/* Write your header.. */
header("Content-Type: text/html; charset=utf-8");
/* Functions Starts */
function myFunc($URL){
$myFunc= get_meta_tags($URL);
return $myFunc;
}
$URL = "http://www.refactormycode.com"; $_myFunc= myFunc($URL); /* PRint it out... */ echo "$URL <p>"; echo $_myFunc["author"]."<p>"; echo $_myFunc["keywords"]."<p>"; echo $_myFunc["description"]."<p>"; echo $_myFunc["robots"]."<p>"; ?>
Refactorings
No refactoring yet !
Alex
August 31, 2010, August 31, 2010 07:25, permalink
I don't see any reason for wrapping the native PHP function. The native function does all the work, just use it by itself. The function and variable names are also of a poor choice.
nielsenaa
October 21, 2010, October 21, 2010 01:15, permalink
No offense, but i fully Agree with Alex ;
The native function does the same ;
Even maybe, if you have thousands of urls to process, you should consider doing the opposite, wrapping your echos in a single function
Zurahn
November 13, 2010, November 13, 2010 04:12, permalink
The pointless wrapping has already been mentioned, but you can better organize your echos into one statement. Multiple echos are also technically less efficient than concatenating first (though unless you're doing an obscene amount of outputs it's going to be negligible).
echo <<<OUT
<p>{$URL}</p>
<p>{$_myFunc["author"]}</p>
<p>{$_myFunc["keywords"]}</p>
<p>{$_myFunc["description"]}</p>
<p>{$_myFunc["robots"]}</p>
OUT;
Hello coders,
I'll share you a new script that can be used in projects to get information about a website like www.denizlikizyurdu.com
You can easily use and share it.
Also waiting for your refactorings.
Best wishes.