GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - PHPSC/php-intro at 1-basic

This repository was archived by the owner on Dec 6, 2019. It is now read-only.
BranchesTags
Open more actions menu
 
 

Latest commit

 

History

3 Commits
3 Commits

Folders and files

NameName
Last commit message
Last commit date
README.md
README.md
 
 

Repository files navigation

Conceitos básicos - Oficina de introdução à linguagem PHP

Nesta parte conheceremos os conceitos mais básicos da linguagem (variáveis, tipos, operadores e erros). Para isso utilizaremos o interpretador interativo (ext-readline), executando o comando abaixo:

php -a

Variáveis

  • Escopo
  • Variáveis variáveis
<?php

$testing = 'blah'; // Escopo global
var_dump($_SERVER); // Escopo superglobal

$blah = 'Uhull!';

echo $$testing; // Variável variável, saída será: Uhull!

Tipos básicos

<?php
// boolean
$testing = true;
$testing = false;

// integer
$testing = 10;

// float
$testing = 5.4;

// string
$testing = "one";
$testing = 'other';

// array
$testing = [1, 2, 3, 'a', 'b', 'c'];
$testing = ['one' => 1];
$testing = array(1, 2, 3, 'a', 'b', 'c');
$testing = array('one' => 1);

// NULL
$testing = null;

Operadores básicos

Bem parecido com Java, exceto:

  • -$x: negação aritimética
  • **: exponenciação
  • ===: comparação identica
  • !==: comparação não identica
  • .: concatenação

Type juggling (black magic! 😄)

$testing = "0"; // string
$testing = $testing + 2; // Agora é int
$testing = $testing + 0.5; // Vixe, float

var_dump(true == 1); // true
var_dump(true === 1); // false

var_dump(true == "true"); // true
var_dump(true === "true"); // false

var_dump(10 == "10"); // true
var_dump(10 === "10"); // false

Erros básicos

  • Parse error
  • Notice
  • Warning
  • Fatal error

Próximo item

Introdução à CLI

About

No description, website, or topics provided.

Resources

Readme
Activity
Custom properties

Stars

1 star

Watchers

1 watching

Forks

18 forks
Report repository

Releases

Packages

Contributors

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.