Web Analytics Made Easy -
StatCounter PHP Testing - CodingForum

Announcement

Collapse
No announcement yet.

PHP Testing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP Testing

    Hi folks,

    This question may have already been asked but I haven't seen it as of yet.

    I'm not a coding expert and I'm egar to get in to it more, but I don't want to pay a monthly subscription to a website, just to test my coding.

    Most free websites give you the annoying templates and don't accept anything other than HTML.



    Is there a website / freeware that I can download to test it in? So far I've been learning the theory, no practise yet

  • #2
    Why not run your code from your local machine? I'm guessing you use windows, look up WAMP. That will give you all the tools you need to run a local web server.

    And/or, codepad.org is a great tool that I use quite a bit when answering questions here and for many other tasks. It allows you to run code (obviously you can't use mysql, sockets or other such functions) for multiple languages - php happens to be one of them . It also gives you the ability to save snippets, and share snippets with other people.
    Useful function to retrieve difference in times
    The best PHP resource
    A good PHP FAQ
    PLEASE remember to wrap your code in [PHP] tags.
    PHP Code:
    // Replace this
    if(isset($_POST['submitButton']))
    // With this
    if(!empty($_POST))
    // Then check for values/forms. Some IE versions don't send the submit button 
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

    Comment


    • #3
      There are several varieties of WAMP the two most popular are XAMPP and (IMO) the uniformserver. Both will turn up on google.

      They contain everything you need: Apache (Webserver), PHP (script programming language), MySQL (Database engine) and a sendmail variant (for connecting via SMTP and sending emails through PHPs mail() function).

      With both wamp systems you can run them manually via a script or install them as system services (which means they run in the background before you logon to your machine and they continue to run if you logoff). Both systems are suitable for hosting your website to the public not just testing however if you choose to do this ensure you have a firewall and I highly recommend running the wamp in a virtual computer - preferably on a seperate physical machine if you have one spare. For testing though you'll be fine running it on your main machine.

      Also, there are a few websites that allow you to test and run PHP code online in your browser. freephptest.com is the first one that springs to mind. You can't use sockets or connect to a database but you can test out other bits of code (eg testing a function) which is very convenient.

      As far as an editor goes, I use notepad++ which supports many languages and also allows you (with a pretty hard to find plugin which I can supply if you can't find it) to debug your php using xdebug. This allows you to inspect the values that variables hold at runtime and step through the code line by line.

      @BP: I just tried codepad.org and for my code I used:
      PHP Code:
      print 'test'
      Shockingly the actual output was : print 'test';


      In other words it didn't run any code. Thats either intentional or its broken.
      Last edited by tangoforce; Sep 13, 2011, 07:47 AM.
      "Tango says double quotes with a single ( ' ) quote in the middle"
      '$Name says single quotes with a double ( " ) quote in the middle'
      "Tango says double quotes ( \" ) must escape a double quote"
      '$Name single quotes ( \' ) must escape a single quote'

      Comment


      • #4
        Originally posted by tangoforce View Post
        There are several varieties of WAMP the two most popular are XAMPP and (IMO) the uniformserver. Both will turn up on google.

        They contain everything you need: Apache (Webserver), PHP (script programming language), MySQL (Database engine) and a sendmail variant (for connecting via SMTP and sending emails through PHPs mail() function).

        With both wamp systems you can run them manually via a script or install them as system services (which means they run in the background before you logon to your machine and they continue to run if you logoff). Both systems are suitable for hosting your website to the public not just testing however if you choose to do this ensure you have a firewall and I highly recommend running the wamp in a virtual computer - preferably on a seperate physical machine if you have one spare. For testing though you'll be fine running it on your main machine.

        Also, there are a few websites that allow you to test and run PHP code online in your browser. freephptest.com is the first one that springs to mind. You can't use sockets or connect to a database but you can test out other bits of code (eg testing a function) which is very convenient.

        As far as an editor goes, I use notepad++ which supports many languages and also allows you (with a pretty hard to find plugin which I can supply if you can't find it) to debug your php using xdebug. This allows you to inspect the values that variables hold at runtime and step through the code line by line.

        @BP: I just tried codepad.org and for my code I used:
        PHP Code:
        print 'test'
        Shockingly the actual output was : print 'test';


        In other words it didn't run any code. Thats either intentional or its broken.
        The annoying thing about codepad, is for PHP you have to wrap in <?php to execute. It's a minor annoyance though haha.

        Personally, I don't like notepad++. I prefer netbeans, which has xdebug support built in. Also has some convenient version control utilities using SVN, mercurial and one other whose name escapes me.
        Useful function to retrieve difference in times
        The best PHP resource
        A good PHP FAQ
        PLEASE remember to wrap your code in [PHP] tags.
        PHP Code:
        // Replace this
        if(isset($_POST['submitButton']))
        // With this
        if(!empty($_POST))
        // Then check for values/forms. Some IE versions don't send the submit button 
        Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

        Comment

        Working...
        X
        😀
        🥰
        🤢
        😎
        😡
        👍
        👎