AmitDiwan has Published 10744 Articles

Remove new lines from string in PHP

AmitDiwan

AmitDiwan

Updated on 27-Dec-2019 07:47:05

678 Views

To remove newlines from the string, the code is as follows−Example Live DemoOutputThis will produce the following output−Demo     text for reference Demo text for referenceExampleLet us now see another example − Live DemoOutputThis will produce the following output−Demo     text Demo text

How to get parameters from a URL string in PHP?

AmitDiwan

AmitDiwan

Updated on 27-Dec-2019 07:42:54

5K+ Views

To get parameters from a URL string in PHP, the code is as follows−Example Live DemoOutputThis will produce the following output−Email = example12@domain.comExampleLet us now see another example − Live DemoOutputThis will produce the following output−Email = demo

How to get numeric index of associative array in PHP?

AmitDiwan

AmitDiwan

Updated on 27-Dec-2019 07:39:23

920 Views

To get the numeric index of an associative array, the code is as follows−Example Live DemoOutputThis will produce the following output−Array key and value... key: a, value: 5 key: b, value: 20 key: c, value: 35 key: d, value: 55ExampleLet us now see another example− Live DemoOutputThis will produce the following output−Array ... Read More

How to get file name from a path in PHP?

AmitDiwan

AmitDiwan

Updated on 27-Dec-2019 07:36:26

879 Views

To get the file name from a path, the code is as follows−Example Live DemoOutputThis will produce the following output−main.phpExampleLet us now see another example − Live DemoOutputThis will produce the following output−main

How to get current function name in PHP?

AmitDiwan

AmitDiwan

Updated on 27-Dec-2019 07:34:12

641 Views

To get the current function name in PHP, the code is as follows−Example Live DemoOutputThis will produce the following output−Base class function! Base class function declared final!string(7) "display" Derived class function! Base class function declared final!string(7) "display"ExampleLet us now see another example − Live DemoOutputThis will produce the following output−Base class function!string(10) ... Read More

How to delete an array element based on key in PHP?

AmitDiwan

AmitDiwan

Updated on 27-Dec-2019 07:30:56

756 Views

To delete an array element based on a key 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 Comma separated list... John , Jacob , Tom , Tim Updated ... Read More

How to search for particular strings between comma separated values in MySQL?

AmitDiwan

AmitDiwan

Updated on 27-Dec-2019 07:11:07

620 Views

For this, use REGEXP. Let us first create a table −mysql> create table DemoTable1902    (    Subjects text    ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1902 values('MongoDB, Java, Python'); Query OK, 1 row affected (0.00 sec) ... Read More

MySQL query to copy records from one table to another with different columns

AmitDiwan

AmitDiwan

Updated on 27-Dec-2019 07:09:41

657 Views

For this you can use INSERT INTO SELECT statement. Let us first create a table −mysql> create table DemoTable1900    (    ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ClientName varchar(20),    ClientAge int default 29    ) auto_increment=1000; Query OK, 0 rows affected (0.00 sec)Insert some records in ... Read More

How to replace a particular character in a MySQL column?

AmitDiwan

AmitDiwan

Updated on 27-Dec-2019 07:06:24

371 Views

To replace a particular character, use REPLACE() and to update, use the UPDATE command. Let us first create a table −mysql> create table DemoTable1899    (    Code varchar(20)    ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1899 ... Read More

MySQL ORDER BY with numeric user-defined variable?

AmitDiwan

AmitDiwan

Updated on 27-Dec-2019 07:05:19

386 Views

Let us first create a table −mysql> create table DemoTable1898    (    Number int    ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1898 values(10); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1898 values(70); Query ... Read More

Advertisements