Posts in the "PHP" Category

  • So here it is, how to what I did with java, but with php. Fun stuff!
    date_default_timezone_set($timeZone);
    $epoch = mktime($hour, $min, $sec, $month, $day, $year);
    date_default_timezone_set($serverTimeZone);
    echo date(”Y-m-d H:i:s”,$epoch);
    mktime generates the epoch time for the date entered, you change the time zone back to the server and there you go, converted date time

    Read More...
  • PHP String manipulation

    String manipulation in php is rather an easy affair, here is some simple methods to find strings within strings, extract strings, find out the length of a string and all that fun stuff kids like to do nowadays.

    Read More...
  • PHP Basics: Break out of loops (stopping a loop)

    Hello, so you have a common loop
    for($i = 0; $i < $j; ++$i){
    }
    but you may want to stop the loop before the loop finished, so how do you do this?
    You use the break statement!
    so using the previous example, lets add a break statement to it
    for($i = 0; $i < $j; ++$i){
    break;
    }
    That will end [...]

    Read More...
  • PHP directory scanning

    Here is the code i have mocked up to check the root directory and 1 directory down for a dir specified in $mainDirArray and then it will exit out of the loop. $mainBLDirArray are dirs to avoid.
    Hope this helps, probably not the most optimised way to do it but works well in testing.
    $conn_id1 = ftp_connect($ftp_host);$login_result [...]

    Read More...
  • Hey Wuup readers. I’ve got a simple post here for those learning PHP, or even the more seasoned programmer. If you’re looking for a simple way to to remove white space from strings, and strip html tags from strings too, try this out. It can be handy if you don’t want people to abuse a form [...]

    Read More...
  • PHP String Functions

    I’ve been doing an awful lot of string manipulation so I thought I would make todays article about the PHP functions I use most regularly for cleaning up and manipulating content entry.

    Read More...
  • Hey Wuup readers. I’ve got a simple post here for those learning PHP, or even the more seasoned programmer. If you’re looking for a simple way to to remove white space from strings, and strip html tags from strings too, try this out. It can be handy if you don’t want people to abuse a [...]

    Read More...
  • The long overdue CRON job

    CRON jobs. I’ve always known about them, I used to use variations of them in my first job. Scheduled tasks set to fire at a particular time or date, or with a particular frequency.

    Read More...
  • Hi there,
    Today we are talking about PHP excetions, very handy stuff you know, and available from PHP5 and onwards (current at time of this article), the throw and catch is similar to other programming languages which also use ‘Try’ and ‘Catch’ exceptions.
    The point of these exceptions, is that PHP can be ‘thrown’ something, and errors [...]

    Read More...
  • Hi there PHP fans! (lol I sound like an American sports commentator). Ok we’re going to take a look at PHP Boolean logic, it’s a tutorial, so we’ll take you through it simply and give you some examples. Easy peasy! – It won’t take long.
    PHP Boolean Type
    Booleans are the simplest php ‘type’. A boolean expresses [...]

    Read More...