
Search In
Hello Readers!, If you have an array whose key index are missing then you could use the 'array_values' function to easily reindex the array.
Let's see the example below:-
<?php
$array = array( 0 => 'string1', 2 => 'string2', 4 =>
This article demonstrate two predefined functions of PHP to add and remove values from begining of an array.
1.array_shift(): This function removes first element of an array and returns the removed value. The numeric keys of array are automatically
Basically this tag is used with select statement to find and retrieve the data from multiple tables . And this can be done with the help of join query .
suppose i have two tables , name is student and teacher then i can add the columns with the help
To convert the rows to column in MySQL
Sample query:
select column1, count((case when (column2 = 'M') then 0 end)) AS `males`, count((case when (column2 = 'F') then 0 end)) AS `females`,count(0) AS `Total` from table_name group by column1
def sub_lists(list1):
sublist = [[]]
for i in range(len(list1) + 1):
for j in range(i + 1, len(list1) + 1):
sub = list1[i:j]
sublist.append(sub)
return sublist
l1 = [1, 2, 3, 4]
print(sub_lists(l1))
Joomla have many versions. So before installing Joomla your system required to fulfill the following requirements which varies according to the version you are using:
Joomla Version
Software
Databases
Web Servers
3.x
PHP *Recommended:* 5.4 + *M
Hash:
Hashes are way of storing data in key-value pair format. Key can be any ruby object ( i.e. string, numbers ). Here we will see some of mostly used methods for hashes.
1) Creating/Initializing a hash:
Hash can be created in differen
Write a Bubble Sort program that sorts the given input array in descending order and prints the number of swaps made after m passes in the algorithm.
Sample Input 1:
2
4
1 2 3 4
Sample Output 1:
5
DECODE function:
DECODE function works similar to if-else statement or case statement. DECODE compares expression to each search value one by one and returns the result of that search which is equal to the expression. If there is no match than defau
.to_a is used to specify range. It is a method that converts an object into an array
Example
$, =", " # Array value separator
range1 = (1..10).to_a
range2 = ('bar'..'bat').to_a
puts "#{range1}"
puts "#{range2}"
Output
1, 2, 3, 4, 5, 6, 7, 8, 9
