Home » Tag Archives: substr()

Tag Archives: substr()

Check whether url contains http or https using php

Sometimes the programmer need to identify the link contains http or https. Using php code can do this easily. First store the string to a php varible- $URLstring=”http://smarttips.in/smarttips_logo.jpg”; Second use the substr() function to find the occurrence of http or https -substr($URLstring, 0, 7) <?php $fromUrl =’0′; $URLstring=”http://smarttips.in/smarttips_logo.jpg”; if(substr($URLstring, 0, 7) == “http://”) { $fromUrl = “http”; } else if(substr($URLstring, 0, 8) ...

Read More »