Questions tagged as 'php'

2
answers

URL friendly, how to work with HTACCESS

I have created some rules in my .htaccess file to format the URL view, but I am having difficulty passing the parameter to the page that shows the products and show formatted, the code looks like this: RewriteEngine On RewriteRule ^P...
asked by 11.03.2015 / 21:19
3
answers

Difference between PATH_SEPARATOR and DIRECTORY_SEPARATOR

The documentation on this is rather vague, the little that exists does not clearly clarify the difference between the use and purpose of the following two PHP constants: PATH_SEPARATOR and DIRECTORY_SEPARATOR At first glance, it seems...
asked by 22.01.2014 / 12:19
9
answers

How to debug code in PHP?

For example, in javascript we have console.log to debug, find out where the errors are, etc. And in PHP, what would be the best ways ?     
asked by 17.02.2014 / 00:05
6
answers

Is there any advantage in using the filter_input function instead of isset?

I've always been used to using isset to check if an external variable is populated and if you're using it. Example: if(isset($_GET['pag'])) $pag = $_GET['pag']; Now I've installed NetBeans and give me a Warning to say t...
asked by 10.10.2014 / 12:23
1
answer

What is the ~ (useful) operator in PHP?

What is the ~ (useful) operator in PHP? I have seen things like: echo ~PHP_INT_MAX Until then I thought it was to "reverse" a negative number or something, but with the tests I saw that I was wrong. Example: echo ~2; //Imprim...
asked by 03.08.2015 / 17:12
3
answers

NSA Challenge - "Thirteen men and one shipment"

Browsing the internet looking for challenges (to be solved with programming), I found the "Thirteen men and a load", where said to be part of the NSA's random challenges (link ). The challenge : After your last trip, the 13 pirates of...
asked by 19.03.2018 / 02:22
3
answers

How to write code as an example, without executing?

I'm doing the translation of a book to an HTML page, there in the book have the codes, but how do I make my HTML display my code, HTML, PHP and JavaScript without running them?     
asked by 24.04.2015 / 15:02
3
answers

Search the data for the last 7 days from the current date

I am making a query to DB, and I want to receive results for the last 7 days from the current date. For this, I have a data field of type DATA (yyyy-mm-dd) in the table. I'm doing the query in php, mysql turn. $query = mysql_query(SELEC...
asked by 14.03.2014 / 12:59
4
answers

What is the "spaceship operator" of PHP7?

I was checking out the New Features of PHP 7 and I came across an operator, which I had never seen in any programming language. The PHP Manual has demon- strated it from Spaceship Operator . I'll show you what I've seen below: echo...
asked by 16.09.2015 / 17:48
2
answers

How to humanize a date in PHP

How to humanize a date in PHP? For example, from that date 2015-08-20 , I want the function to return Há uma semana , because it's strange to read something like foi publicado há 754 dias or publicado há 38 semanas .   ...
asked by 30.08.2015 / 00:19