Began to study pkhp. Passing the topic of function. Wrote a function to output links.

<?php function link() { echo "<a href='http://vkontakte.ru'>Сайт Вконтакте</a>"; } // line 15 link(); ?> 

I run, the browser gives this error:

Fatal error: Cannot redeclare link() in Z:\home\localhost\www\php\function2.php on line 15

And line 15 is the closing curly handle of the function. What is the problem?

    2 answers 2

    Everything is simple, a function with that name already exists, you are trying to re-create it, this cannot be done, call it differently.

      In PHP, there is already a function named link , rename your function, and it will work.

      • Thanks, earned. But the fact is that he wrote from the video lesson, the recording is identical - it went there, but I don’t. Sorry, maybe I'm stupid where, but I don’t see the logic. - Bogdan Ostapchuk
      • Video tutorials - evil IMHO) Most likely the author php 3 or build without these functions (link, symlink etc.) - Sh4dow
      • what video tutorials? - Alexander Zheleznovsky
      • You know, I, too, such an opinion) he always said that himself) but I just started to study. I still need the basics and understanding of the language. And I found some good lessons from Evgeny Popov. It is clear that to study the language seriously on video is nonsense, but how to begin with - fit in. Maybe you will advise that you need a beginner to learn pkhp (not video))). I will be glad. - Bogdan Ostapchuk
      • one
        But mark on the main tag php + training and you will be happy) There were many such questions. - Sh4dow pm