{
  "id": "03",
  "content": [
    {
      "type": "heading",
      "text": "Types & Type Juggling"
    },
    {
      "type": "text",
      "html": "Common types: string, int, float, bool, array, object, null. PHP is dynamically typed and can coerce types (type juggling)."
    },
    {
      "type": "text",
      "html": "<pre><code>&lt;?php\n $a = \"7\";            // string\n $b = 3;              // int\n $c = $a + $b;        // 10 (string \u2192 int)\n var_dump($c);\n</code></pre>"
    },
    {
      "type": "text",
      "html": "Use strict types when possible:<pre><code>&lt;?php\ndeclare(strict_types=1);\n</code></pre>"
    }
  ],
  "quiz": {
    "questions": [
      {
        "id": "q1",
        "type": "single",
        "text": "PHP\u2019s typing is:",
        "options": [
          {
            "id": "a",
            "text": "Dynamic"
          },
          {
            "id": "b",
            "text": "Static only"
          },
          {
            "id": "c",
            "text": "No types"
          }
        ],
        "correct": [
          "a"
        ]
      },
      {
        "id": "q2",
        "type": "single",
        "text": "What does <code>declare(strict_types=1)</code> do?",
        "options": [
          {
            "id": "a",
            "text": "Enforces strict type checks for scalar type declarations"
          },
          {
            "id": "b",
            "text": "Disables errors"
          },
          {
            "id": "c",
            "text": "Makes PHP faster by default"
          }
        ],
        "correct": [
          "a"
        ]
      }
    ]
  }
}