which pattern should i adopt to comment my php code?
<p>i just finished Coding my PHP application now the coding has become somewhat Huge and and the comments i am using is looking Ugly and Ineffective, as every single line of code i have commented with // , this is my first coding and i am totally unaware of the methodology to adopt to make my comments look nicer and cleaner for the future reference to me or anyone. i would appreciate if someone suggest me the pattern with example..</p>

<p>Here is the function i wrote with the ugly comments i used. which pattern would you use for commenting the code?</p>

<pre><code>//function to check if the uploaded Image is valid
    function valid_image($image, $target, $url, $width, $height = 0) {
            //Check if the uploaded image is of type jpeg
            //if not then pop up a warning message and return false and redirect back
        if( $image["type"] !== "image/jpeg") {
            alert('File must be of type image/jpeg'); 
            redirect_url($url);           
            return false;
            }
            //Check the file Dimension of the Uploaded Image if it matches with the defined Value
             //Get the Dimensions of the image
            list($image_width, $image_height) = getimagesize($image['tmp_name']);
            //If the Parameter Height is empty then just check the image width and ignore the height rule
            //Print the appropriate message and return false and redirect back
        if( $height == '0') {
        if( $image_width !== $width) {
            alert("Incorrect File Dimension for  " . $image['name'] . " Please make sure it is $width in width");
            redirect_url($url);
            return false;
            }
            }
            //If the function has got all the parameter then check both the defined height and width 
            //Print the appropriate message and return false and redirect back
    else if($image_width !== $width || $image_height !== $height) {
            alert("Incorrect File Dimension for  " . $image['name'] . " Please make sure it is  $width X $height  ");
            redirect_url($url);
            return false;
            }
            return true;
            }
</code></pre>

<p>Thanks in Advance. </p>
