PHP substr() function

php substr function

<?php   // PHP program to illustrate substr() function Substring($str){     $len = strlen($str);     echo substr($str, 8), “\n”;     echo substr($str, 5, $len), “\n”;     echo substr($str, -5, 10), “\n”;     echo substr($str,-8, -5), “\n”; }   // Driver Code $str=”blogsforblogs”; Substring($str);   ?> Output: blogs forblogs blogs for The substr() is a built-in function in PHP that is … Read more

Impact of web hosting on online business

Impact of web hosting on online business Now a days, e-commerce has moved online – and not just for big guys like Amazon, but for millions of smaller companies selling their wares and capabilities. At the same time, these business owners have also seen an increase in the options available for how they host and … Read more

Rename database in MySQL

mysql 5.7

From phpMyAdmin, select the database you want to select. In the tabs there’s one called Operations, go to the rename section. That’s all. It does, as many suggested, create a new database with the new name, dump all tables of the old database into the new database and drop the old database. Other method: Create … Read more

get the difference between two timestamps in seconds

get the difference between two timestamps in seconds   You could use the TIMEDIFF() and the TIME_TO_SEC() functions as follows: SELECT TIME_TO_SEC(TIMEDIFF(‘2010-08-20 12:01:00’, ‘2010-08-20 12:00:00’)) diff; +——+ | diff | +——+ | 60 | +——+ 1 row in set (0.00 sec) You could also use the UNIX_TIMESTAMP() function. SELECT UNIX_TIMESTAMP(‘2010-08-20 12:01:00’) – UNIX_TIMESTAMP(‘2010-08-20 12:00:00’) diff; +——+ | diff | +——+ | … Read more

Convert decimal seconds time in Excel h:mm:ss format

convert decimal seconds to excel time

Convert decimal seconds time in Excel h:mm:ss format Generic formula =seconds/86400 Explanation To convert seconds in decimal format to a proper Excel time, divide by 86400. In the example shown, the formula in C6 is: =B6/86400 To display the result as time, apply a time format. Column D shows the same result formatted with [h]:mm. … Read more

How to identify server IP address in PHP

php how to example

How to identify server IP address in PHP   or the server ip: $_SERVER[‘SERVER_ADDR’]; and this for the port $_SERVER[‘SERVER_PORT’]; You can use this in CRUL as below: <?php // create a new cURL resource $ch = curl_init (); // set URL and other appropriate options curl_setopt ($ch, CURLOPT_URL, “http://blog.eduguru.in/test”); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt … Read more

IPTABLES : Introduction to Linux Firewall

IPTABLES : Introduction to Linux Firewall   Linux is the most-used open source operating system. Managing network traffic is one of the toughest jobs to deal with.  For this, we must configure the firewall in such a way that it meets the system and users requirements without leaving the system vulnerable. The default firewall in most of the Linux distributions is IPTables. IPTables is … Read more

Setup SFTP Server on linux

Setup SFTP Server on linux CentOS 7 or any Linux server distribution is a very powerful server that performs above and beyond what your business might need. Whatever task you throw at the server, it will be ready. And, if it isn’t ready out of the box, you can make it so. A complete and simple … Read more

asterisk task processors : high queue size warning

asterisk

asterisk task processors : high queue size warning You may have seen the “task processor queue reached 500 scheduled tasks” in asterisk. Let’s understand what is the meaning of this warning and what this cause. Task processors have been in Asterisk for a long time. Since Asterisk v12, they have become more important because the … Read more