Skip to content

Instantly share code, notes, and snippets.

View billhance's full-sized avatar

Bill Hance billhance

  • Startup
  • Los Angeles
View GitHub Profile

PHP Developer Interview: What you should know

###1. What’s the difference between " self " and " this " ?

Use $this to refer to the current object. Use self to refer to the current class. In other words, use $this->member for non-static members, use self::$member for static members.

Source: When to use self vs this -stackoverflow

@billhance
billhance / gist:3036863
Created July 3, 2012 01:16 — forked from nikita2206/gist:3035134
If String Contains
<?php
if(!function_exists('if_string_contains'))
{
function if_string_contains($needle,$haystack) {
if (is_array($needle)) {
foreach ($needle as $n) {
if (strpos($haystack, $n) !== false) {
return true;
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class CI_Session
{
var $flash_key = 'flash'; // prefix for "flash" variables (eg. flash:new:message)
function __construct()
{
$this->_sess_run();