Are there any best practices or guidelines for inserting code snippets in PHP to ensure efficient and effective implementation?

When inserting code snippets in PHP, it is important to follow best practices to ensure efficient and effective implementation. One key guideline is to properly format and comment the code to make it easily understandable for other developers. Additionally, it is recommended to avoid duplicating code and instead use functions or classes for reusable code segments.

// Example of a properly formatted and commented code snippet
// This function calculates the sum of two numbers
function calculateSum($num1, $num2) {
    return $num1 + $num2;
}