Skip to content

ThirteeNov

My personal blog about coding and internet

Menu
  • About me
  • About Zofia Kreasi
  • Cart
  • Checkout
  • Making an airplane game from scratch in Unity
  • My account
  • Privacy Policy
  • Privacy Policy – zkLeaderboard
  • Sample Page
  • Shop
  • Tutorials on Learning JavaScript
  • ZKAccounts – Privacy Policy
Menu

PHP useful snippets

Posted on February 20, 2018August 4, 2020 by Habibie

This page is dedicated for a bunch of PHP useful snippets and codes that we often use it in web development.

Opening and Closing PHP Tags

To write any php codes, you will always need to put that codes inside opening <?php and closing ?> tags. Otherwise it will not be executed.

For example:

<?php echo "Hello world!"; ?>

Including another php files

It’s a good practice if we can create separated php file contains all reusable functions then we include that file whenever we need it.

To include a php file we can do it like this:

include "aphpfile.php";

After we included it, all those functions inside that file is accessible for us.

Session to be started and destroyed

If we deal with “user login and logout”, we need to put session_start(); at the beginning of our php file. Then, if user logged out, we need to destroy that session by calling session_destroy();

Post Views: 384
ciihuy2020

Welcome!

  • My YouTube Channel
  • My GitHub Page
  • About me

Categories

  • 3DVista
  • Android
  • Apache
  • C#
  • Cordova
  • Electron & Node JS
  • HTML5, CSS & JavaScript
  • iOS
  • Let's Make Unity Games
  • Misc
  • Photoshop
  • PHP
  • Python
  • Uncategorized
  • Unity
  • WordPress

Recent Posts

  • Hover Reveal script for Unity to show and hide object on mouse hover
  • How to Prevent UI Clicks in Unity from “Bleeding Through” to 3D Objects Behind Them
  • Make objects like wires and cables easily in Unity using Ciihuy Curved Mesh
  • [SOLVED] Can’t Add Custom Domain to Blogger After Losing CNAME Verification
  • iOS App Icon Generator by CiihuyCom
© 2026 ThirteeNov | Powered by Superbs Personal Blog theme