Skip to content

Instantly share code, notes, and snippets.

@danilobatistaqueiroz
Last active July 27, 2018 18:58
Show Gist options
  • Save danilobatistaqueiroz/49d1ecf80d9eeb67ccb65050bb2d541d to your computer and use it in GitHub Desktop.
Save danilobatistaqueiroz/49d1ecf80d9eeb67ccb65050bb2d541d to your computer and use it in GitHub Desktop.
zend php certification

You can also delete cookies by supplying setcookie an empty value.

setcookie("w3p_cookie", ""); 

Here's the easiest way to unset a cookie:

setcookie('name', 'content', 1);

Instead of this:

<?php setcookie( "TestCookie", $value, time()+(60*60*24*30) ); ?> 

You can this:

<?php setcookie( "TestCookie", $value, strtotime( '+30 days' ) ); ?> 

Calling functions using string:

<?php

function myfunction($a, $b = true)
{
	if($a && !$b) {
 		echo "Hello, World!\n";
 	}
}

$s = array(
 0 => "my",
 1 => "call", 
 2 => '$function', 
 3 => ' ',
 4 => "function", 
 5 => '$a',
 6 => '$b', 
 7 => 'a',
 8 => 'b',
 9 => '');

$a = true;
$b = false;

/* Group A */
$name = $s[0].$s[4].$s[9].$s[9].$s[9].$s[9];
/* Group B */
'myfunction'(${$s[7]}, ${$s[8]});

$name(${$s[7]}, ${'b'});

Valid php tags:
<% %>

Not valid:
<! !>

The << operator is a left-shift operator, which effectively multiplies an integer number by powers of two

$h = 16;
$c = 4;

echo $h << $c;

echo '<BR/> this is equivalent to: <BR/>';

echo $h * ($c * $c);

echo '<BR/> and: <BR/>';

echo $h * pow($c,2);

exclusive-or (xor) operator returns True if either of its operands can be evaluated as True, but not both.

The following expressions multiply the value of the integer variable $a by 4

$a *= pow (2, 2);
$a >>= 2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment