CodeHint


PHP (12 items)

PHP


    echo
/* Echoes some message: */
echo "Hello world";
  Edit
    print
/* Print some message but returns boolean too */
print("Hello world");
  Edit
    strpos ( string $haystack , string $needle [, int $offset ] )

Retorna a posição numérica da primeira ocorrência de needle dentro de haystack. Diferentemente de strrpos(), esta função pode ter uma string inteira como o parâmetro needle e toda a string será usada

  Edit
    is_null()

Verifies if its null

  Edit
    unset()

Unset variable (different from null. Null is a type)

  Edit
  Heredoc example
$html = <<<HTML
  <div class='something'>
    <ul class='mylist'>
      <li>$something</li>
      <li>$whatever</li>
      <li>$testing123</li>
    </ul>
  </div>
HTML;
  Edit
    strtolower($WORD)

Converts to lower

  Edit
    strtoupper($word)

Converts to upper

  Edit
php --version

Checks php version duhhh

  Edit
  php-fpm.conf Location

/opt/PHP-5.6/etc/php-fpm.conf

  Edit
  Server magic variables

$_SERVER['REQUEST_URI']

  Edit
  CORS Policy example
if (isset($_SERVER["HTTP_ORIGIN"]) === true) {
	$origin = $_SERVER["HTTP_ORIGIN"];
	$allowed_origins = array(
		"http://public.app.moxio.com",
		"https://foo.app.moxio.com",
		"https://lorem.app.moxio.com"
	);
	if (in_array($origin, $allowed_origins, true) === true) {
		header('Access-Control-Allow-Origin: ' . $origin);
		header('Access-Control-Allow-Credentials: true');
		header('Access-Control-Allow-Methods: POST');
		header('Access-Control-Allow-Headers: Content-Type');
	}
	if ($_SERVER["REQUEST_METHOD"] === "OPTIONS") {
		exit; // OPTIONS request wants only the policy, we can stop here
	}
}
  Edit