In what ways can the code be optimized to adhere to best practices for PHP development?

Issue: To optimize the code for PHP development, it is essential to follow best practices such as using proper naming conventions, organizing code into functions, avoiding global variables, and utilizing built-in PHP functions efficiently. Code snippet:

<?php

// Bad practice: Using global variables
$number = 5;

function multiplyByTwo() {
    global $number;
    return $number * 2;
}

echo multiplyByTwo();

// Good practice: Avoiding global variables and using function parameters
function multiplyByTwo($number) {
    return $number * 2;
}

echo multiplyByTwo(5);
?>