
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
Found 26504 Articles for Server Side Programming

1K+ Views
To trim all strings in an array in PHP, the code is as follows−Example Live DemoOutputThis will produce the following output−Array with leading and trailing whitespaces... Value = John Value = Jacob Value = Tom Value = Tim Updated Array... Value = John Value = Jacob Value = Tom Value = TimExampleLet us now see another example − Live DemoOutputThis will produce the following output−Array with leading and trailing whitespaces... Value = Kevin Value = Katie Value = Angelina Value = Jack Updated Array... Kevin Katie Angelina Jack

3K+ Views
To sort an array of dates in PHP, the code is as follows−Example Live DemoOutputThis will produce the following output−Array ( [0] => 2019-08-10 [1] => 2019-09-08 [2] => 2019-10-10 [3] => 2019-11-11 )ExampleLet us now see another example − Live DemoOutputThis will produce the following output−Array ( [0] => 2019-11-11 [1] => 2019-11-11 [2] => 2019-10-10 [3] => 2019-09-08 [4] => 2019-05-11 [5] => 2019-01-01 )

253 Views
To check substring in a string, the code is as follows in PHP −Example Live DemoOutputThis will produce the following output−String = How I Met Your Mother Substring = Mother Substring found successfullyExampleLet us now see another example − Live DemoOutputThis will produce the following output−String = In the Heart of Sea Substring = Ocean Substring not found

3K+ Views
To add days to $Date in PHP, the code is as follows−Example Live DemoOutputThis will produce the following output−Displaying date... Date = 2019-11-11 Displaying updated date... 2019-12-01ExampleLet us now see another example − Live DemoOutputThis will produce the following output−Displaying Date...2019/11/11 Displaying Updated Date... 2019/12/06

761 Views
To convert string to boolean in PHP, the code is as follows. Use the filter_val() method−Example Live DemoOutputThis will produce the following output−Displaying Sunday as first day of a week... First day (next week) = Sunday - 15/12/2019 bool(false)ExampleLet us now see another example − Live DemoOutputThis will produce the following output−bool(false) bool(true) bool(false) bool(false)

2K+ Views
To get the first day of the week in PHP, the code is as follows −Example Live DemoOutputThis will produce the following output −First day = Monday - 09/12/2019ExampleLet us now see another example − Live DemoOutputThis will produce the following output −Displaying Sunday as first day of a week... First day (next week) = Sunday - 15/12/2019

302 Views
To get the first element of an array in PHP, the code is as follows −Example Live DemoOutputThis will produce the following output−Array value ... Value 1 = 150ExampleLet us now see another example − Live DemoOutputThis will produce the following output −Value 1 = 150

394 Views
To get random value out of an array in PHP, the code is as follows−Example Live DemoOutputThis will produce the following output −Array values ... Value 1 = 150 Value 2 = 100 Value 3 = 120 Value 4 = 110 Value 5 = 115 Value 6 = 103 Value 7 = 105 Value 8 = 125 Random value from arary = 110ExampleLet us now see another example − Live DemoOutputThis will produce the following output−Array values ... Value 1 = 150 Value 2 = 100 Value 3 = 120 Value 4 = 110 Value 5 = 115 Value 6 = 103 Value 7 = 105 Value 8 = 125 Random values from array...150 115

238 Views
To concatenate two strings in PHP, the code is as follows −Example Live DemoOutputThis will produce the following output−1.967 and 1.969 Both the values are equal!ExampleLet us now see another example − Live DemoOutputThis will produce the following output−First Name = Jack Second Name = Sparrow Concatenation = JackSparrow

752 Views
To compare float values in PHP, the code is as follows −Example Live DemoOutputThis will produce the following output−2.5 3.5 Both the values aren\'t equalExampleLet us now see another example − Live DemoOutputThis will produce the following example−1.967 1.969 Both the values are equal!