Questions tagged as 'php'

1
answer

How to get current directory name in PHP

I searched Google and here in SOpt, but I did not find any sites, or ask here to answer this question. Example: I'm on page index.php which is in /5/index.php , then only 5 should be caught. How to print this on the pag...
asked by 20.12.2016 / 06:48
1
answer

Why in PHP is it possible to access functions before the line they were declared?

Why in PHP is it possible to call a function before the line where it was declared? echo ah(); // 'Ah!' function ah() { return 'Ah!'; } Notice that I called ah() first, then declared. Even so, she was executed. But the function...
asked by 05.12.2016 / 16:59
2
answers

What is the right way to connect to the MySQLi database

I have a question that has brought me various incompatibilities. With the evolution of PHP and Mysql, more recent versions have appeared, this way the Mysqli. This is where my problem resides, I would like to know which is the correct way to con...
asked by 23.09.2014 / 20:29
1
answer

How to mark boldly sequentially triplicate and quadruplicate characters in a string?

I want to mark the triplicate and quadruplicate sequences of a string like this: $string = "AAACDEAAAABBBUUDD"; And I would like to get the following result: <b>AAA</b>CDE<b>AAAA</b><b>BBB</b>UUDD   ...
asked by 22.05.2017 / 19:03
1
answer

Is it recommended to use loose return in a PHP file? When?

It's good practice to give a return in a simple PHP file example: <?php $config['teste'] = 123; return $config; I will explain better this file di / dependencias.php: <?php $container['daoExemplo'] = function ($c) { return n...
asked by 16.01.2018 / 15:13
2
answers

Find words between characters {}, and remove from text in PHP?

$comoesta = "{A,O} {portador,portadora} é o mais {especializada,especializado} para o serviço ."; If it's masculine: $comodeveficar = "O portador é o mais especializado para o serviço "; If it's feminine: $comodeveficar = "A portadora...
asked by 17.01.2017 / 13:08
1
answer

String in php is a class?

String in java is a special class, where you can instantiate the object only by assigning a value without using the reserved word new . But in php when initializing a variable with a text, can we say that we are instantiating an object of...
asked by 09.04.2015 / 06:15
2
answers

How to access information from a .torrent file?

I would like to know if it is possible and how to get information ( magnet link, seedes, leechers, peers, etc.) from a .torrent file using PHP .     
asked by 29.04.2015 / 19:23
4
answers

Another option to use @ in PHP?

I do not feel very comfortable having to use @ before some variables and sessions when I make conditions, to avoid Unexpected Index error that happens when the variable or session was not initialized previously. I wanted to know...
asked by 12.05.2015 / 16:29
2
answers

How to list more than 50 Youtube videos using cURL

I need to return all videos from a certain youtube user, but my current function only returns 50, which is the maximum allowed by the API. is there any method to do this? $cURL = curl_init(sprintf('http://gdata.youtube.com/feeds/api/users/%s/u...
asked by 04.04.2014 / 14:52