1. Go to this page and download the library: Download huytbt/php-array-view 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/ */
huytbt / php-array-view example snippets
if (!function_exists('arrayView')) {
/**
* Get the evaluated view contents for the given view.
*
* @param string $view
* @param array $data
* @param array $mergeData
* @return \ChickenCoder\ArrayView\Factory
*/
function arrayView($view = null, $data = [], $mergeData = [])
{
static $factory;
if ($factory == null) {
$viewPaths = [ dirname(__FILE__) . '/views' ]; // array of view path
$factory = new \ChickenCoder\ArrayView\Factory($viewPaths);
}
if (func_num_args() === 0) {
return $factory;
}
return $factory->render($view, $data, $mergeData);
}
}