Questions tagged as 'php'

3
answers

How to print a constant in the middle of a string, without concatenating?

Is there any way to print a constant in the middle of a string , without using concatenation, how do you do with variables in PHP? Example: $nome = 'wallace'; echo "Meu nome é {$nome}"; For constants, I know I could print concatenatin...
asked by 15.09.2015 / 22:53
3
answers

How to prevent a method from printing data when calling a third-party API?

I am using an API and in some cases a feature of it prints on the screen when there are errors (api errors, not PHP). It happens that I call this API via AJAX and it breaks my code since the request ends up generating an invalid JSON. Is ther...
asked by 23.01.2014 / 19:36
1
answer

Upload does not work $ _FILES undefined index error

When uploading a file I'm getting the following error:    Notice: Undefined index: file in Z: \ web \ upload.php on line 3 upload.php: <?php $location = 'uploads/'; $arquivo = $_FILES['file']; if ($arquivo) { $name = $arquivo['n...
asked by 17.02.2015 / 15:09
2
answers

How to send SMS for free using PHP? [closed]

I wonder if there is any way to send SMS for free to Brazilians cell phones. I have already seen some PHP systems with this function, and I would like to have this function on my system as well.     
asked by 11.12.2013 / 17:13
2
answers

What is the purpose of: (colon) in PHP?

I have this question that is leaving me with fleas behind the ear. I do not understand, not at all. What does the sign for : have two points. Can anyone explain me? Example: if ( have_posts() ) : while ( have_posts() ) : the...
asked by 20.06.2017 / 22:01
2
answers

How can I force refresh after deploy?

I have a web application made in PHP, and I wanted to force that whenever I deploy a new version of the application the client would be obliged to update everything that had changed, such as images, CSS, JS, etc. p> How can I do this?     
asked by 22.02.2018 / 20:54
2
answers

What are the advantages and disadvantages of declaring constants as an array?

I found this new feature a lot of way around PHP 5.6. It is now possible to set a array to the value of a constant. See how cool: const BR_DATES = [ 1 => 'Janeiro', 2 => 'Fevereiro', 3 => 'Março', 4 =>...
asked by 03.03.2015 / 15:06
2
answers

What are Exceptions and how should I create and organize them in PHP

I'm creating an MVC system and want to implement Exceptions on my system. But I've never used it particularly. So I wanted to know how the Exceptions should be applied, since I saw here in StackOverflow in Portuguese someone talking (I can not...
asked by 03.09.2015 / 22:06
2
answers

Function and method are the same thing?

When we talk about methods and functions, are we saying the same thing? For example: function blablabla blabla Is this a method?     
asked by 12.06.2017 / 19:53
5
answers

How to get the name of the current file

Recently I had a problem identifying the current page. I was using __FILE__ to get the current file, and used substr() to get the string after the last occurrence of bars, it turns out that on some operating systems these bars w...
asked by 23.11.2015 / 19:02