Jukebox Music
Jukebox Music

Reputation: 33

Meaning of _(' ') in php and what inside it?

I was reading and learning a code and I found this code, infoBookingsTitle shows the title of the page, which is "Reservation options", I tried to found this file to edit the "Reservation options" word with something else but I didn't know where should I look, like what is that a PHP file, class or what?

          <div>

          <h2>   <?php __('infoBookingsTitle') ?>  </h2>

          </div>

Thanks.

Upvotes: 2

Views: 959

Answers (1)

Stevish
Stevish

Reputation: 729

It's not built into PHP, but like @SLaks said, it's usually for translation. When a different language file is used, it will look through that file for the translation of infoBookingsTitle and show that instead. Usually the __() function will return the string, and the _e() function will echo it.

<?php
echo __('Hello');
_e(' World');

// Result: "Hello World" will be displayed, unless a translation file is available

Upvotes: 1

Related Questions