Jump to content

Difficulty Sorting


Bob Norris

Recommended Posts

STOP

 

A couple things on the loadfile() function:

 

1. Using the global keyword is very bad practice as it causes scope pollution and defeats the purpose of using a function to begin with (bad times). You should be passing any information needed by the function via the functions parameter list.

2. Instead of initializing 5 arrays and storing values in each, you should be building a muti-dimensional array instead. This will make it cleaner and much easier to sort further down in the code.

3. split() is deprecated and should no longer be used, use preg_split instead.

 

I'm sure there are more errors further down but lets start there for now.

Also, it would be helpful if you posted any errors that are being displayed.

Edited by AyKay47
Link to comment
Share on other sites

STOP

 

A couple things on the loadfile() function:

 

1. Using the global keyword is very bad practice as it causes scope pollution and defeats the purpose of using a function to begin with (bad times). You should be passing any information needed by the function via the functions parameter list.

2. Instead of initializing 5 arrays and storing values in each, you should be building a muti-dimensional array instead. This will make it cleaner and much easier to sort further down in the code.

3. split() is deprecated and should no longer be used, use preg_split instead.

 

I'm sure there are more errors further down but lets start there for now.

Also, it would be helpful if you posted any errors that are being displayed.

Appreciate it Im just in over my head. There are a couple of other files in the script I thought it might be an easy catch for you wizzes. There is function PHP that is pretty short and it may be in there.

 

<?php

    function DateCmp($a, $b)

    {        

        if (strtotime($a) == strtotime($b)) {

           return 0;

       }

       return (strtotime($a) < strtotime($b)) ? -1 : 1;

}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.