
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
AmitDiwan has Published 10744 Articles

AmitDiwan
476 Views
We are required to write a JavaScript function that finds how many times a specific letter is appearing in the sentence.ExampleThe code for this will be −const string = 'This is just an example string for the program'; const countAppearances = (str, char) => { let count = 0; ... Read More

AmitDiwan
510 Views
We are required to write a JavaScript function that takes in an array of Numbers and returns a new array with elements as the sum of two consecutive elements from the original array.For example, if the input array is −const arr1 = [1, 1, 2, 7, 4, 5, 6, 7, ... Read More

AmitDiwan
235 Views
We are required to write a JavaScript function that takes in two arrays of Numbers and checks whether all the elements of the first array exist in the second or not.ExampleThe code for this will be −const arr1 = [34, 78, 89]; const arr2 = [78, 67, 34, 99, 56, ... Read More

AmitDiwan
261 Views
We are required to write a function that takes in two arguments, first is a string and second is a number. The length of string is always less than or equal to the number. We have to insert some random lowercase alphabets at the end of the string so that ... Read More

AmitDiwan
433 Views
We have an array that contains String and number mixed data types, we have to write a sorting function that sorts the array so that the NaN values always end up at the bottom.The array should contain all the valid numbers in the front, followed by string literals, followed by ... Read More

AmitDiwan
3K+ Views
Simply use, array_merge() to concatenate two arrays in PHP. Let’s say the following are out arrays −$nameArray1 = array('John', 'David'); $nameArray2 = array('Mike', 'Sam');Now, set both the above arrays in array_merge() to concatenate them.The syntax is as follows −array_merge($yourFirstArrayName, $yourSecondArrayName);ExampleThe PHP code is as follows Live Demo ... Read More

AmitDiwan
3K+ Views
To check whether a string has no whitespace, use the preg_match() in PHP.The syntax is as follows preg_match('/\s/',$yourVariableName);ExampleThe PHP code is as follows Live Demo OutputThis will produce the following outputThe name (John Smith) has the space

AmitDiwan
11K+ Views
For this, you can use the strtotime() method.The syntax is as follows −$anyVariableName= strtotime('anyDateValue + X minute');You can put the integer value in place of X.ExampleThe PHP code is as follows Live Demo OutputThis will produce the following output2020-10-30 10:15:20

AmitDiwan
1K+ Views
Let’s say the following is our PHP array $listOfNames = array('John', 'David', 'Mike', 'David', 'Mike', 'David');We want the output to display the count of values in the above array like this −Array ( [John] => 1 [David] => 3 [Mike] => 2 )To get the count, use inbuilt function array_count_values().ExampleThe PHP ... Read More

AmitDiwan
322 Views
Let’s say the following is our string array −$full_name= '["John Doe", "David Miller", "Adam Smith"]';We want the output in a single string −John Doe, David Miller, Adam SmithFor this, use json_decode().ExampleThe PHP code is as follows Live Demo OutputThis will produce the following outputThe Result in one ... Read More