Issue Solved: CodeIgniter Use of undefined constant VIEWPATH

Use of undefined constant VIEWPATH issue occurs when you upgrade your existing CodeIgniter application version to CodeIgniter 3.x. The undefined constant viewpath issue can be easily solved by the following solution. Open the root’s index.php file and specify the view directory to solve this issue.

How to Convert File Size in Bytes to KB, MB, GB in Javascript

Generally, when we get the file size in JavaScript, it returns in bytes format. But if want, you can easily convert file size to human readable format using JavaScript. Use our custom formatFileSize() function to convert the size from bytes to KB, MB, GB, TB, PB, EB, ZB, YB using Javascript.

How to Get an Array of Specific Key from Multidimensional Array

Code optimization can reduce the execution time of the script. Using the looping statements, you can get an array of a specific key from the multidimensional array. But the same work can be done in a single line of code by array_column() function in PHP.

How to Get File Info (name, size, type) in JavaScript

Before sending the file to the server for upload, it always a good idea to validate the file. Using JavaScript you can easily get the file info and validate in client-side. The following single line of javaScript code, help you to get the file name, size, type, and modified date.

How to Convert PHP Array to JavaScript Array

PHP array can be used in JavaScript, whatever the array is a single or multidimensional or indexed or associative array. You can convert PHP array to JavaScript array easily with a single line of code. Using json_encode() function, PHP array can be converted to JavScript array and accessible in JavaScript.

How to Get the Text Value of Selected Option using jQuery

You can access two types of value from select element. First one is the value to be sent to the server, which can easily get using the jQuery. The second one is the text value of the select element. Based on your requirement, single or both values can get from the select element.

How to Open URL in New Tab using JavaScript

JavaScript method opens URL in a new browser window. Use _blank in the second parameter of method to open a URL in a new tab using JavaScript.

How to Get the Value of Selected Radio Button using jQuery

Most of the cases the value of selected radio button gets after form submit. But if you want to get the value of selected radio button before form submits, with jQuery you can do it easily. The jQuery :checked selector helps to get the value of selected radio button.

How to Filter Multidimensional Array by Key Value in PHP

PHP array_filter() function filters elements of an array by a callback function and it can be used for many purposes. The array_filter() function provides a short and simple way to filter multidimensional array by key and value. Use array_filter() to filter values from multidimensional array similar to SQL LIKE using array_filter() function in PHP.