How to add colon separated hours in PHP using explode function twice?

Problem Statement

Tracking hours for multiple days are available in HH:MM:SS format separated by tab element. Add all the time to show total hours worked/tracked.

$a="03:23:28	03:58:54	00:00:00	03:10:49	02:17:33	03:56:38	02:18:23	06:15:42	00:00:00	00:00:00	06:04:51	07:41:09	03:23:15	06:12:59	03:51:27	00:00:00	04:30:06	05:00:23	00:00:00	04:34:25	05:17:02	01:36:21	00:00:00	03:53:20	06:30:52	06:21:47	04:54:16	03:22:28	03:10:35	00:00:00	06:37:11	02:14:22	03:06:49	03:05:44	02:35:54	04:03:22	00:00:00
#$a="04:05:21	06:25:39	03:02:36	04:01:17	03:03:21	02:00:36	04:21:54	04:21:35	00:00:00	00:00:00	03:39:21	04:19:17	03:08:14	01:44:48	03:28:11	00:00:00	03:05:53	03:05:34	00:00:00	02:09:17	05:01:13	01:02:20	00:00:00	04:30:51	06:03:49	06:36:35	02:14:01	03:06:38	04:02:09	00:00:00	02:34:29	03:36:30	05:10:17	06:46:19	07:48:08	09:13:34	00:00:00
$a="07:28:49	10:24:33	03:02:36	07:12:06	05:20:54	05:57:14	06:40:17	10:37:17	00:00:00	00:00:00	09:44:12	12:00:26	06:31:29	07:57:47	07:19:38	00:00:00	07:35:59	08:05:57	00:00:00	06:43:42	10:18:15	02:38:41	00:00:00	08:24:11	12:34:41	12:58:22	07:08:17	06:29:06	07:12:44	00:00:00	09:11:40	05:50:52	08:17:06	09:52:03	10:24:02	13:16:56	00:00:00
foreach($f as $ele){

echo "$th:$tm:$ts";

A list of few productivity plugins and useful websites for web developers

Browser Extensions

1. To know the platform and background details of any website – use Wappalyzer (chrome extension)

2. To protect privacy over internet, use privacy badger (chrome extension)

3. To get away with distractions, use stayfocusd (chrome extension)

4. You hate CORS warnings in console, to get rid of them, use Allow-Control-Allow-Origin plugin for chrome

5. Developers and sys admins keep playing with DNS all the time, but browsers use cache and are lazy in updating the record. Use DNS Flusher

6. Sometimes, you just want to check the website before actually moving the DNS or IP record, use Virtual Hosts (chrome extension)
you can set IP of any domain name to anything

7. JSONView – use this extension to view any json with indentation

8. For sharing screenshots very quick, you can use two plugins Nimbus screenshot and Lightshot

Useful Websites

HTML Online Editor

Free online HTML editor with WYSIWYG and source composer and instant preview and many useful built-in features

Stack Overflow

Huge programmer community where you usually don’t have to ask for help because probably someone has already answered the same question.


The place to learn web technologies. There’s a big chance that this site gives the first search result when you’re looking for a HTML term.


Collaborate with other developers. Fork, send pull requests and manage all your public and private git repositories.

Built With

Enter a domain name to find out who is hosting it, what CMS and framework is used and many other insights.


Fast real-time website screenshot API. If you are a backend guy, handling multiple sites and uptime can get messy. This api can really help you in managing the tasks relating to visibility of your website across the web.

HTML Color Codes

Search and save color codes. Search by name or mix the RGB, HSV or CMYK values. Use the generated HTML/CSS codes.


Browse the large directory of free photos, vector arts, icons, illustrations, PSD files at FreePic.

PageSpeed Insights

This tool by Google analyzes the submitted link from mobile and desktop to suggest you what to consider optimizing.

Google Fonts

An interactive directory of over 800 free hosted web fonts. It allows to optimize loading speed by including only what you need.

Image placeholders with customizable size. Just add the image resolution after the domain name, for example×250

Speed Test by GT-Metrix

Analize the loading speed of a website from many available servers. The website creates a detailed analysis with screenshot and waterfall view.

Similar sites- Pingdom  and


The most popular icon set based on CSS and LESS. The vector icons can be customized as text – size, color, drop shadow

XML Sitemaps

Generate XML sitemaps and URL list of a website. The crawl limit is 500 pages.

Post Image

Post images online for free and share them via links on messages, forums or emails


Register to create, save and share HTML-CSS-JS code snippets and run them online.

Write PHP Online

Name suggests it all. Post your code and see what it does. In PHP


Pastebin is a website where you can store text online for a set period of time and share it with anybody or privately

How to get all attributes with all available labels/options in Magento2?

I did a lot of research but could not find a solution for that. so gathered some info and created this code: (it is not the best way to do it, but it works – you can use it at least one time for quick results)
the values need to be transformed if you want to see them properly in csv

Here is how to print all available attributes in backend and along with their all available options aka labels

        use \Magento\Framework\App\Bootstrap;
        $bootstrap = Bootstrap::create(BP, $_SERVER);
        $objectManager = $bootstrap->getObjectManager();
        //use Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory;
        $collection= $objectManager->get('\Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory')->create();
//$attr_groups = array();
        foreach ($collection as $items) {
                        $attr_groups = $items->getData();
                                                if($attr_groups['frontend_input']=="select" or $attr_groups['frontend_input']=="multiselect"){
//echo $attr_groups['attribute_code'].'<br>'.$attr_groups['frontend_input'].'<br>'.$attr_groups['frontend_label'].'<br>'.$attr_groups['attribute_id'].'<br>';
foreach($eav as $getlabel) {
        $r = new ReflectionObject($getlabel['label']);
$p = $r->getProperty('text');
//echo $p;
        $ft[]= $p->getValue($getlabel['label']);
        $ft[]= $getlabel['label'];

WordPress Dashboard – Introduction by newbie

Dashboard Panel

When you will log into the administration area of your blog, you’ll see the WordPress Dashboard which will display the overview of the whole website.  You can customize your needs by using some quick links such as writing quick draft, replying to latest comment, etc.

Dashboard Menu

The WordPress Dashboard provides a navigation menu that contains some menu options such as posts, media library, pages, comments, appearance options, plugins, users, tools and settings on the left side.

Welcome Section

It includes the “Customize Your Site” button which allows customizing your WordPress theme. The center column provides some of the useful links such as creating a blog post, creating a page and view the front end of your website.

Quick Draft

The Quick Draft is a mini post editor which allows writing, saving and publishing a post from the admin dashboard. It includes the title for the draft, some notes about the draft and save it as a Draft.

WordPress News

The WordPress News widget displays the latest news such as latest software version, updates, alerts, news regarding the software etc. from the official WordPress blog.


The Activity widget includes latest comments on your blog, recent posts and recently published posts. It allows you to approve, disapprove, reply, edit, or delete a comment. It also allows you to move a comment to spam.

At a Glance

This section gives an overview of your blog’s posts, number of published posts and pages, and number of comments. When you click on these links, you will be taken to the respective screen. It displays the current version of running WordPress along with the currently running theme on the site.

Extracting names from given list of URLs (using regex)

let us extract name form the URL
paste the URL in the notepad and press crtl+f , and select ‘regular expressions ‘ from search mode

find in notepad

now, enter the regex in the find tab to fetch names

Now, the selected name will be fetched form regex as (\1).

it can work on numerous links like:-

And only the part after first “?=” will be fetched

How to install a new theme in WordPress using a compressed theme file

Follow these steps to install a new WordPress theme to your website using a compressed theme file(.zip,.tar,.rar etc):

Step 1: Open the wp-content folder in the root directory of WordPress and go to the themes folder.

Step 2: Upload the zip(or any other compressed file) theme file inside the theme folder.

Step 3: Go back to the theme folder, select the compressed theme file and click on extract.

Step 4: After the file is extracted you may still not see the extracted folder, so click on reload. Also, delete the zip file as it obsolete now.

Step 5: Now, go to the WordPress dashboard of your website and click on Appearance>Themes.

Step 6: You can now see your new theme in the installed themes section. Hover on your new theme and click Activate to activate the theme.

Congratulations you have finally installed and activated a new theme!

How to remove links of a learndash course which has not started yet? without code changes

var nost=0;
$("#lessons_list a.notavailable").removeAttr("href");
$("#lessons_list a.notavailable").each(function(){
toba = toba.replace("lesson post-",'');
toba = toba.replace(" is_not_sample no-topics",'');
toba = toba.replace(" is_not_sample has-topics",'');
$('#learndash_topic_dots-'+toba+" a").removeAttr("href");

Simple joining of data from two different tables on basis of a common key

SELECT a.user_id,a.meta_value,b.user_login FROM `e_usermeta` a,`e_users` b where a.meta_key="phoneno" and a.user_id=b.ID
SELECT a.user_id,a.meta_value,b.user_pass,b.user_login FROM `e_usermeta` a,`e_users` b where a.meta_key="phoneno" and a.user_id=b.ID order by b.user_login
UPDATE `wp_users` a,`tmptable` b SET a.`user_pass`=b.`usp` where a.`user_login`=b.`ulogin`;

How to change WordPress user roles in MySQL database using PhpMyAdmin?

We will be editing the database rows using PhpMyAdmin tool given with cPanel by many hosting companies

You can change the WordPress user roles by following the given steps:

Step 1: Open phpMyAdmin on cPanel.

Step 2: Open the wp_usermeta or xxx_usermeta table in the database as highlighted. (wp_ is just prefix, your table prefix may be different)

wordpress tables in database

Step 3: In wp_usermeta table, you can find wp_capabilities under meta_key column.

User Roles in usermeta table

Step 4: The roles are saved in form of serialized PHP array. Change the user role you want to assign to the current user by changing the meta_value as:






Magento 2 cli commands [continued]

1. Setting GD2 as defualt image adapter from command line 

Magento >= 2.2
php bin/magento config:set dev/image/default_adapter GD2
php bin/magento cache:clean
Magento >= 2.2
 mysql --host=(host) --user=(user) --password=(password) -D (database) -e "\ UPDATE core_config_data SET value = 'GD2' WHERE 'dev/image/default_adapter' = path; \"; 

 2. Disable Minify CSS Files option from command line

Magento >= 2.2
php bin/magento config:set dev/css/minify_files 0
php bin/magento cache:clean
Magento < 2.2
mysql --host= --user= --password= -D  -e "\ UPDATE core_config_data SET value = 0 WHERE 'dev/css/minify_files' = path; \";
php bin/magento cache:clean

3. Disable Merge CSS Files option from command line


php bin/magento config:set dev/css/merge_css_files 0
php bin/magento cache:clean
Magento < 2.2
mysql --host= --user= --password= -D  -e "\ UPDATE core_config_data SET value = 0 WHERE 'dev/css/merge_css_files' = path; \";
php bin/magento cache:clean