PHP code example of zhalker / php-literal

1. Go to this page and download the library: Download zhalker/php-literal library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zhalker / php-literal example snippets



$name = `Zhalker`;

$list = [
    `apple`,
    `banana`,
    `cherry`
];

function salute($name) {
    return `Im "{$name}"`;
}

echo `Hello!!\n {salute($name)}`;

echo "\nList of fruits:\n";

foreach ($list as $key => $value) {
    echo `<div><span>Item {$key}: </span><span>{$value}</span></div>`;
}


 //Main.php
use function PHPLiteral\PHPLiteral;

// Example:

// Output raw
Hello!!
 Im "Zhalker"
List of fruits:

    <div><span>Item 0: </span><span>apple</span></div>
    
    <div><span>Item 1: </span><span>banana</span></div>
    
    <div><span>Item 2: </span><span>cherry</span></div>

//Output rendering

Hello!! Im "Zhalker" List of fruits:
Item 0: apple
Item 1: banana
Item 2: cherry
bash
composer