Hardcoding an IP address into source code is a bad idea for several reasons:

Recommended Secure Coding Practices

Noncompliant Code Example

$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($socket, '8.8.8.8', 23);  // Noncompliant

Exceptions

See