- preg_replace: documentation ( source)
- define: documentation ( source)
<?php
$courseData['auth_url'] = 'http://learn.kognito.com/auth';
define('COURSE_PORTAL_URL', "https://dev-learn.kognito.com/auth");
$pattern = '/https?:\/\/learn[.]kognito[.]com\/auth/';
$replacement = COURSE_PORTAL_URL;
$courseData['auth_url'] = preg_replace($pattern, $replacement, $courseData['auth_url'], 1);
echo $courseData['auth_url'] . "?k=";