Oct 14

I was browsing around the PHP online manual (the single best resource for learning about PHP) and I came up with several things that I didn't know about that were pretty interesting.

  1. Alternate syntax for control structures (if, while, etc)
    <?php $a = "b";
    if($a == "a"): ?>
    a = a
    <?php elseif($a == "b"): ?>
    a = b
    <?php else: ?>
    a = ?
    <?php endif; ?>
  2. Changing modified and accessed time of a file
    touch("fake.txt", time()-1*60*60*24*365, time()-1*60*60*24*365);
  3. Highlighting a file for PHP syntax with one line
    highlight_file('file.php');

Actually, I already knew about all of these, I just wanted to share :P

  • Digg
  • StumbleUpon
  • del.icio.us
  • Reddit

2 Responses

  1. AskApache Says:

    nice tips! I especially like the modifying the access time and modified time.. and didn't know about the highlight_file one… dugg!

  2. admin Says:

    Thanks, man, glad you found something useful :)

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.