PHP

sorting array value without using built in php like sort() etc

Sorting array value without using built in php like sort() etc Bubble sort in php <?php $array =array(‘2′,’4′,’8′,’5′,’1′,’7′,’6′,’9′,’10’,’3′); echo ‘Unsorted array’; print_r($array); for($i = 0; $i<count($array); $i++){ for($j = 0; $j <count($array)-1; $j++){ if($array[$j] > $array[$j+1]){ $temp = $array[$j+1]; $array[$j+1] = $array[$j]; $array[$j] = $temp; } } } echo ‘Sorted array’; print_r($array); ?> Reverse Order…

Read More

Composer require runs out of memory. PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted

Composer require runs out of memory. PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted To get the current memory_limit value, run: php -r “echo ini_get(‘memory_limit’).PHP_EOL;” Check php configuration file php –ini sudo nano /usr/local/etc/php/7.4/php.ini Try increasing the limit in your php.ini file (ex. /etc/php5/cli/php.ini for Debian-like systems): ; Use -1 for unlimited or…

Read More

Add Remove Input Fields Dynamically using jQuery

Step 1: Create Database Table CREATE TABLE `info` ( `id` int(11) NOT NULL, `name` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; Step 2: Create index.php File <html> <head> <title>jQuery Add & Remove Dynamically Input Fields in PHP</title> </head> <body> <h1>jQuery Add & Remove Dynamically Input Fields in PHP</h1> <form name=”add_me” id=”add_me”> <table id=”dynamic”> <input type=”text”…

Read More