-2

I am new to PHP and I real need a help with this error. It keep me all night awake try to figure out to might be the problem but I can't get it right.

Parse error: syntax error, unexpected 'function_construction' (T_STRING), expecting function (T_FUNCTION) in C:\xampp\htdocs\amimo\includes\database.php on line 6

This is my code:

<?php

function strip_zeros_from_date($marked_string = "") {
    // first remove the marked zeros
    $no_zeros = str_replace('*'), '', $no_zeros);
    $cleaned_string = str_replace('*0', '' , $no_zeros);
    return $cleaned_string;
}

function redirect_to($location = NULL) {
    if ($location!: = NULL) {
        header("location :{$location}");
        exit;
    }
}

function out_message($message = "") {
    if (! empty($message)) {
        return "<p class=\"message\">{$message}</p>";
    } else {
        return"";
    }
}

?>
user3942918
  • 24,679
  • 11
  • 53
  • 67
tina
  • 1
  • 1

1 Answers1

2

you have problem in this line-

$no_zeros =str_replace('*'),'' , $no_zeros);

it should be

 $no_zeros =str_replace('*','' , $no_zeros);

also in this line

if($location!: = NULL){

should be

if($location != NULL){

also in this line

return"<p class=\"message\">{$message} </p>";

it should be

return  "<p class=\"message\">{$message} </p>";

also in this line

return"";

it should be

return "";
Anant Kumar Singh
  • 68,309
  • 10
  • 50
  • 94
Sugumar Venkatesan
  • 3,782
  • 7
  • 39
  • 71