Category: PHP

How to Create PDF using DOMPDF in Codeigniter

In this topics, we will discus about how to create PDF using DOMPDF with Codeigniter Framework. We are going to use a third-party library called Dompdf that enables us to create PDFs and save them to the server or directly display them. Step 1: Create Librarie (application/libraries/Dompdf_gen.php) Step 2: Call Librarie in Controller Step 3: Controller Function […]

PHP array_unique() Function

The array_unique() is used to remove duplicate values from an array. Note: The keys are preserved. array_unique() sorts the values treated as a string at first, then will keep the first key encountered for every value, and ignore all following keys. It does not mean that the key of the first related value from the […]

PHP array_rand() Function

The array_rand() function returns a random key from an array, or it returns an array of random keys if you specify that the function should return more than one key. Returns a random key from an array, or an array of random keys if you specify that the function should return more than one key […]

PHP array_chunk() Function

The array_chunk() function splits an array into inside of array. The last chunk may contain less than size elements. The array_chunk() function splits an array into chunks and stores the chunks into new arrays. Parameter Description array Required. Specifies the array to use size Required. An integer that specifies the size of each chunk preserve_key […]

PHP ksort() Function

The ksort() function sorts an array by key, maintaining key to data correlations. This is useful mainly for associative arrays. Tip: Use the krsort() function to sort an associative array in descending order, according to the key. Tip: Use the asort() function to sort an associative array in ascending order, according to the value. Parameter Description array Required. Specifies […]

PHP array_walk() Function

The array_walk() function apply a user defined function to every element of an array. The user-defined function takes array’s values and keys as parameters. Tip: To work with deeper arrays (an array inside an array), use the array_walk_recursive() function. Parameter Description array Required. Specifying an array myfunction Required. The name of the user-defined function parameter,… Optional. Specifies […]