PHP replace web address test in variable

14
July 12, 2018, at 02:10 AM

can anyone help with this? I have a web address as a variable and would like to replace multiple web address if they exist.

$value = (!empty($_SERVER['HTTPS']))
? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] 
: "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

Say if part of the URLs exist within the variable, then replace with a different one. Maybe str_replace would be the best way but unsure how to do it with more than one possibility.

ie. If the following are to be stored, store https://www.url4.com/ instead.

https://www.url1.com/

https://www.url2.com/hello/

https://www.url3/

READ ALSO
Ignore optional parameter in Laravel?

Ignore optional parameter in Laravel?

Currently within my routes file I've got the following Route defined:

30
Laravel: Trying to access value inside array in view template

Laravel: Trying to access value inside array in view template

So I'm trying to access the value of a few pair of key->values inside an array I create and pass to the view called config, I'd like to access to them like this : {{ $config->web_name['value'] }} or {{ $config->$web_name['value'] }} but both are returning...

8
Error on sending e-mail via SMTP

Error on sending e-mail via SMTP

This is my code for sending emailBut i am getting error and page keeps loading for long time

49
Use Xdebug with PhpStorm and WSL

Use Xdebug with PhpStorm and WSL

I use WSL (Ubuntu 1614) from Windows 10 as a web server with PHP 7

16