Questions tagged as 'php'

3
answers

Pick letters from the name string

I need to get the first letter of the name and the first after the space, in case it would look like this: $string = 'Renan Rodrigues'; Expected result: 'RR'; How to do this?     
asked by 03.01.2017 / 16:49
3
answers

How to execute .sh file on button

It is possible to execute a file that .sh in a button , example: /bin/importa.sh   in a <a href""></a> is also good.     
asked by 21.10.2016 / 21:02
3
answers

Generate 5-digit combinations

How do I generate combinations in 5-digit php ranging from 0 to 9? In the same case, in the future you want to add letter, how should it be done?     
asked by 02.08.2017 / 00:25
4
answers

Null values in PHP

In PHP 7 what is the correct way to define and identify null values? Which of these is the correct way to assign null? $valor = null; $valor = ""; Which of these is the correct way to identify null values? if($valor == null){} if($va...
asked by 20.09.2017 / 15:34
2
answers

How to make a random query in MySQL without repeating data?

I'm creating a Pinterest-type image-type site that, in addition to other things, needs to combine the following features: Infinite Scrool (I'm applying this code here: link ). A menu to choose in which order to display the images....
asked by 04.09.2018 / 03:16
2
answers

Open and close the code or use variable?

Two scripts with the same result: Example 1: <?php ...códigos PHP acima... $tabela = '<table>'; $tabela .= '<tr>'; $tabela .= '<th> Valor1 </th>'; $tabela .= '<th> Valor2 </th>'; $tabela .= '<th...
asked by 25.07.2018 / 17:54
3
answers

Operation in PHP. Multiplication using percentage

<?php echo $i['sellingStatus'][0]['currentPrice'][0]['__value__']; ?> How can I multiply% by% by 2 and then add 60% to the total value? Example: Valor = 10 Multiplica por 2 = 20 Acrescenta 60% = 20 * 60% = 12 Total = 20 + 12 = 32....
asked by 31.03.2014 / 14:20
2
answers

How to log in only active users?

In authentication, in addition to the data required to log in, I want only those with status ativo = 1 to log in, but I do not know how to do this. table user: id username email password ativo UserController public function...
asked by 08.01.2014 / 03:44
3
answers

Convert string number to PHP integer

I am converting a string to integer in PHP, however in the return of settype($variavel, "integer") , or (int)$variavel bring me a null value or equal to 1. Is there another way to try the conversion? The code I'm having is thi...
asked by 31.08.2015 / 21:22
3
answers

Pagseguro does not redirect client after payment

After the payment, the client should be redirected to the thank-you page that I set up, but that's not what happens. I've got an API, I just needed to set up 2 files, they are: PaymentPagseguro.php and PagSeguroConfig.php . Th...
asked by 30.03.2015 / 02:22