
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
574 Views
You need to iterate using three for loops and lookup in given day, month and year. If the day, month and year is available, then put them into a variable.ExampleThe PHP code is as follows Live Demo OutputThis will produce the following outputThe next date value is ... Read More

AmitDiwan
802 Views
Let’s say the following is our string with new line $sentence = " My name is John Smith My Favorite subject is PHP. ";We need to remove the new line above and replace with a whitespace i.e. the output should be −My name is John Smith My Favourite subject is PHP.For ... Read More

AmitDiwan
558 Views
For this, use preg_split() along with array_shift() and array_pop(). Let’s say the following is our string with letters and numbers $values = "5j4o5h8n";We want to display the numbers and letters in separate arrays.ExampleThe PHP code is as follows Live Demo OutputThis will produce the following outputArray ( [0] ... Read More

AmitDiwan
5K+ Views
To print time an hour ago, you need to subtract -1 hour. Use the strtotime() method and set the subtraction value in it i.e. -1 for 1 hour ago time, -2 for 2 hour ago time, etc.Let’s say the current time is 18:42:22ExampleThe PHP code is as follows Live Demo ... Read More

AmitDiwan
266 Views
For this, at first use preg_split() and set the function with this −'//u'After setting like above, the empty delimiter issue will get fixed, since we added '//u' above.ExampleThe PHP code is as follows Live Demo OutputThis will produce the following output −Array ( ) Array ( [0] ... Read More

AmitDiwan
3K+ Views
Let’s say we have the following two arrays $firstArray=array(10,20,30,40,50); $secondArray=array(100,80,30,40,90);We need to find the matching i.e. the output should be 30 40ExampleThe PHP code is as follows Live Demo OutputThis will produce the following output The matching result is=30 The matching result is=40