Questions tagged as 'php'

3
answers

Check if html form numeric field has a maximum of 6 numbers with PHP

I need to test if field is filled and if it is composed of up to 6 numbers using the PHP language     
asked by 07.05.2018 / 19:10
2
answers

Form php receives value other than typed

I have a form in PHP. When I submit it, I should get the values coming from $ _POST. But it turns out that the returned data comes only with value 1. I do not know what's going on. Everything seems normal. : <form method="POST" action=""...
asked by 23.02.2014 / 02:17
2
answers

What will be the result of $ a?

I was studying PHP and seeing questions, to improve my knowledge in the area. Here is an excerpt of an issue:    Given a snippet of code written in the PHP language, like the one below: $a = array("a", "b", "c", "d"); $a[] = "e"; The...
asked by 18.08.2017 / 21:40
1
answer

How to use "count if" in PHP

I need to make a count se in PHP . I have a table with several statuses, and I want to count only one type. I need to count by PHP. By SQL is impracticable. $data = Connection::Select('SELECT * FROM tabela'); $row = $data-...
asked by 27.01.2017 / 18:54
3
answers

How do I get a String size correctly using UTF8?

I'm doing some tests and I realized that the string has special characters and counts more than one in substr . Example: $string = "PAÇOCA"; echo strlen($string); echo substr($string, 0, 3); I should print: PAÇ but only p...
asked by 08.07.2016 / 20:03
3
answers

How to format title for url format?

For example, I have a title: 'Test Title Url'. But I need to leave it in url format, is there any function that does this?     
asked by 15.04.2015 / 16:48
2
answers

How to improve the process of generating non-repeated random numbers?

I have a algorithm for creating random numbers for lottery that have the following characteristics: 1 ° You must be informed of the number of numbers to be generated. 2 ° Numbers can not be repeated. 3 ° The numbers need to be in ascend...
asked by 08.01.2015 / 19:25
1
answer

What is the difference between print and echo in PHP [duplicate]

What would be the difference between using print or echo in PHP, since both print text on the screen. When is it best to use one? echo "echo"; print "print";     
asked by 29.12.2014 / 17:13
4
answers

Filtering td with PHP

I have several <td> <td>Conteúdo</td> <td>Conteúdo</td> <td>Conteúdo</td> <td>Conteúdo</td> <td>Conteúdo</td> <td>Conteúdo</td> I wanted to split these...
asked by 18.12.2014 / 20:17
1
answer

Warning when trying session_start (); PHP [duplicate]

Does anyone know what this warning might be? Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at *caminho*) in *caminho* on line 2 Warning: session_start() [function.ses...
asked by 09.08.2014 / 00:27