Recap - Variable Init
Part of the Fundamentals section of Coddy's PHP journey — lesson 10 of 71.
Challenge
EasyWrite code that initializes the following variables:
kwith the value88(note: lowercase 'k')PIwith the value3.14(note: uppercase 'PI')namewith the value“Sophie”.
Make sure you use the exact variable names and values. Remember:
- PHP is case sensitive! (
k≠K)- String values must be enclosed in quotes:
"Sophie"notsophie
Try it yourself
<?php
# Type your code below
echo "k = $k\n";
echo "PI = $PI\n";
echo "name = $name\n";
?>All lessons in Fundamentals
4Comparison & Logical Operators
Comparison OperatorsEquality & IdentityLogical Operators Part 1Logical Operators Part 2Recap - Simple Logic2Variables and Data Types
NumbersStrings and QuotesBooleansNaming ConventionsRecap - Variable InitEmpty VariablesString ConcatenationGetting User InputCast to Different Types5Conditional Logic
If StatementIf - ElseThe Ternary OperatorNull Coalescing OperatorSwitch StatementRecap - Making Decisions3Basic Operators
Arithmetic OperatorsModulo OperatorExponentiation OperatorCombined AssignmentIncrement/DecrementOperator PrecedenceRecap - Simple CalculationsString Operators