Archives Wild Code School
PHP

✏️ Exercise 1 - Naming Variables

Quête 9 sur 14 · 1 image archivée

Introduction

image

⚠️ Before starting this quest, you must have finished the following quests:
Quêtes liées

In this serie of exercises, you will mainly play with animal emojis. Why? Because emojis are short, fun and animals are cutes !

Attention

Emojis are treated as characters (strings), not as image. '🐒' is like an 'A' or a 'W', so you should always use quotes around to display it.

💪 Challenge

In this challenge, you will have to find a better name for the variable $var, according to the naming rules best practices.

  • in English
  • no abbreviation
  • in camelCase (in PHP, other languages could have other rules for variable format)
  • meaningful that means the variable name should be clear and reflect data it refers to.

Let's start, copy/paste the code below in your IDE and try to find an appropriate name for each line!

Info

💡 Help

Brackets [] are used to declare an array, that means a group of data, you will learn more about array very soon. Arrays contain multiple datas, so, most of the time, you should use a plural name.

php
$var = '🐒';
$var = '🦍';
$var = '🦧';
$var = '🐕';
$var = '🐺';
$var = '🦊';

$var = ['🐒', '🦍', '🦧'];
$var = ['🐒', '🦍', '🦧', '🐺', '🐅', '🐷', '🐘', '🐎'];
$var = ['🐋', '🐬'];
$var = ['🐒', '🦍', '🦧', '🐺', '🐅', '🐘', '🐎', '🐋', '🐬'];
$var = ['🐋', '🐬', '🐟', '🐠', '🐡', '🦈', '🐙', '🐚', '🦀'];
$var = ['🐟', '🐠', '🐡', '🦈'];
$var = ['🦕', '🦖'];
$var = ['🦄', '🐉'];
$var = ['🐄', '🦃', '🐓', '🐷', '🐑', '🐐', '🐎', '🐇'];
$var = ['🐕', '🐱', '🐦', '🐠', '🐹'];
$var = ['🦃', '🐓', '🐧', '🕊️', '🦅', '🦆', '🦢', '🦉', '🦩', '🦚', '🦜'];
$var = ['🐸', '🐊', '🐢', '🦎', '🐍'];
$var = ['🦋', '🐜', '🐝', '🐞', '🦗', '🦟'];
$var = ['🕷️', '🦂'];
$var = ['🕷️', '🦂', '🐍'];
$var = ['🐺', '🐅', '🦊', '🦁', '🐻', '🐊', '🦈', '🦖'];
$var = ['🐄', '🐑', '🐇', '🐨', '🦙', '🦌', '🐪'];

🧐 Acceptance criteria

  • [ ] The variable names follow the naming rules.
  • [ ] The variable names are understandable.