Questions tagged as 'php'

2
answers

Remove comma from the last foreach value in PHP [duplicate]

Good morning, I have a foreach in my system and I need to separate the pro comma items, so the foreach is like this foreach($value as $item){ echo $item . ','} The result obviously comes out: 1,2,3, How do I get this last comma, r...
asked by 05.09.2016 / 16:04
4
answers

removing part of a string with php

I have a variable with the following link: https://www.youtube.com/embed/z1n34sRv1-A I need to remove everything that comes before the embed, or I need the following id: z1n34sRv1-A How can I do this with php?     
asked by 12.08.2016 / 20:34
1
answer

Delete item from an array and reorder it - PHP

It is the following: I have an array, more or less like this: $array = [ [0] => 'Fellipe', [1] => 'Fábio', [2] => 'Mateus', [3] => 'Gustavo' ]; I would like it when I remove an item from this array: unset ($ ar...
asked by 24.04.2017 / 06:11
2
answers

With making a count inside the array

Well I have the following array: array (size=3) 0 => array (size=5) 'valor' => string '10.00' (length=5) 'forma' => string '1' (length=1) 'parcelas' => string '' (length=0) 'verifica_nome' => string '' (length=0) 'cli...
asked by 15.03.2017 / 18:37
2
answers

Send file to remote server with PHP

I have a PHP system that I have developed and put online on my server at DigitalOcean, the site has two parts, which visitors will access and the administration area where I manage this site and put the content users will have access. I left...
asked by 02.12.2016 / 20:22
1
answer

duration time of a session

I have a file in php with the following code: // Define o limitador de cache session_cache_limiter('must-revalidate'); $cache_limiter = session_cache_limiter(); // Define tempo da sessão session_cache_expire(300); $cache_expire = session_ca...
asked by 24.11.2016 / 16:49
2
answers

"Robo-Humano" Smart

I'm making a "little human" you send message, and he responds. Example: If you send "Hi" it responds "Hi, how are you?" I know this is basic, you can use switch . switch($mensagem){ case "Oi": $responder = "Ola"; break;...
asked by 13.12.2016 / 17:19
2
answers

How do I add hours to an hour

Well I have the following time in a variable: $x = "10:15"; I have two different questions, How do I add 30 minutes to this time. How do I add 1 hour to this time. Thank you.     
asked by 24.12.2016 / 00:12
1
answer

How to return only unmatched records in a JOIN? [duplicate]

I have a question regarding the use of JOIN in SQL in this case: I have a produtos table and a destaques table that contains the id of the product. I need to make a query that returns only the records that are n...
asked by 17.10.2016 / 00:50
1
answer

PHP class vs function

When and why should I use a class instead of a simple function in PHP? For example, I have a function that performs the insertion of a history in the database, which is a common function to many others. functions.php <...
asked by 24.10.2016 / 23:50