Questions tagged as 'php'

1
answer

How to decrease this code in PHP?

I am making a PHP code that formats the time the site looks for in the database. It's very simple. I wanted to know if you can reduce it. Here is the code: $tempo = new DateTime($abre); $abre = $tempo -> format('H:i'); $tempo = new DateTime...
asked by 03.05.2018 / 14:56
4
answers

Concatenating variables from an array

I need to Concatenate variables of an array, to execute a SQL, this array can have differentiated values. If the array is greater than 1 then it must have $ variable + $ variavel02. If the array is equal to 1. Then just play the variable. $arr...
asked by 10.08.2017 / 15:44
2
answers

I do not understand why empty says that the variable is not empty

There is a membership module where members of a church are registered. For this register will be shown on the main page the birthday of the day in a jQuery slide. But when you do not have a birthday boy, he'll show you something else. When you d...
asked by 22.09.2017 / 17:55
2
answers

Is there any 'native' form tag form to identify change to the original state of a form?

Assuming a form was loaded with 10 text fields with a value of 1, and the user changed one of these to 0. When submitting the form, is there something 'native' that identifies that it has had a change in the value of its fields? I want thi...
asked by 20.09.2017 / 16:21
2
answers

Check is Curl image

Is there any way through the Curl request to know if it's an image or not? $ch = curl_init($image_url); $name = generateRandomString(); $fp = fopen($caminho.'/'.$name.'.png', 'wb'); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT...
asked by 21.08.2017 / 19:32
1
answer

Ternary operator "?:" [closed]

I recently got into a discussion with coworkers about the more compact functionality of the terabyte (x?: 10) and some of them said that it would be removed in php 7. I did a web search and found nothing related to that. Is there any informat...
asked by 04.08.2017 / 19:44
3
answers

Error reading JSON with PHP

I'm trying to read a JSON file in php in the following format: {"leads": [{"id":"1", "email":"[email protected]", "user": "[email protected]", "first_conversion": { "content": { "identificador":"ebook-abc",...
asked by 16.08.2017 / 17:15
3
answers

php function to invert data [duplicate]

I've put together a very simple function to invert the date, see: function inverteData($data) { if(count(explode("/",$data)) > 1){ return implode("-",array_reverse(explode("/",$data))); } else if(count(explode("-",$data)) &...
asked by 15.09.2016 / 15:41
1
answer

How to play a .mp3 file in PHP

I'm learning PHP and I need your help. I saw in a post here that it is possible to touch a .mp3 file in PHP. I did a test like this: <?php echo "Teste"; echo "<embed src='11.mp3' width='1' height='1'>"; ?> The 11....
asked by 01.09.2016 / 04:44
2
answers

mysql deprecated [duplicate]

I'm trying to insert a row in mysql but it's returning this: Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO     
asked by 21.07.2015 / 02:27