-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
  • 25,539
  • 11
  • 55
  • 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 "";
Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
Sugumar Venkatesan
  • 4,019
  • 8
  • 46
  • 77