Questions tagged as 'php'

1
answer

Format date in PHP [duplicate]

I need to show date in PHP in the following format: "Sunday, December 09, 2014"? It has to be in Brazil time! If possible in Portuguese too! EDIT : <?php setlocale( LC_ALL, 'pt_BR', 'pt_BR.iso-8859-1', 'pt_BR.utf-8', 'portug...
asked by 12.08.2014 / 21:14
1
answer

Adding value to a date with PHP

I'm having a problem adding a date that comes from the database that comes as follows: Ex .: 05/10/2018 17:48:27 I'm using the following method to add days to that date: date('d/m/Y H:i:s', strtotime('+10 days', strtotime('10/05/2018 17:48:27'...
asked by 07.08.2018 / 16:21
1
answer

How to replace each match instance of a regular expression with a different value?

I have text (html code) with several images in standard HTML format: <img src="X" atributos /> I need the src attribute value to be replaced with the CID: # identifier where # is a unique value that identifies each image...
asked by 27.06.2018 / 18:53
2
answers

SELECT displaying products except the results of another SELECT

I have this SELECT that takes the 6 best selling products: SELECT IdProduto, SUM(QtdProdutoPedido) as QtdProdutoPedido FROM tb_pedidoproduto GROUP BY IdProduto ORDER BY QtdProdutoPedido DESC LIMIT 6 I wanted a SELECT to show...
asked by 15.12.2017 / 19:56
2
answers

Shortening people's names

I need a script that will shorten people's names. For example: Name: Fernando José Silva Machado With the script, cut the surnames and leave only the initials and the last surname It would look like this: Name: Fernando J. S. Machado...
asked by 17.12.2017 / 18:39
1
answer

Loop in json that returns all records

I am developing a system, I am doing a search with ajax and it returns a json with the bank records, but I could not elaborate a loop in PHP so json would be able to return all records. Here is my code: display.php <div class="for...
asked by 29.05.2017 / 22:24
2
answers

What is the difference between App \ Http \ Requests and Request

What difference in Laravel, from using use App\Http\Requests to use Request ?     
asked by 26.05.2017 / 17:31
1
answer

Replace space with comma and pipe interleaved

I have a certain string below, as you can see, they are coordinates separated by just one space. See:    -23.5209 -46.46466 -23.52008 -46.465952 -23.519253 -46.467239 -23.518808 -46.466901 -23.518738 -46.466848 -23.518411 -46.466597 -23.51834...
asked by 21.06.2017 / 22:45
2
answers

Sort items from a Collection from a predefined value

I have a Collection of Eloquent and would like to sort it by two fields at the same time being one of them a predefined value. Ex: this Collection has several objects of type Categoria and I want to sort it so that catego...
asked by 18.07.2017 / 16:42
2
answers

How to instantiate $ pdo = connect () without repeating?

For example I have a class named user : class User { public $nome; private $email; protected $senha; public function __construct(){ } public function insert($email, $senha){ require_once "conexao.php";...
asked by 21.07.2017 / 20:44