Questions tagged as 'php'

2
answers

How to count the number of characters of the word that came from the first line of a text file?

Below is an example of how to count the number of characters in a string: $palavra ="coisa"; echo strlen($palavra); //retorna o número 5 However, I'm getting this word from a text file and strlen is not working, see: $f = fopen("palavra...
asked by 24.08.2014 / 16:56
1
answer

PHP 7 - Why does a method that returns the primitive type String, does not generate error when returning a Boolean value?

PHP 7 - Why does a method that returns the String primitive does not generate an error returning a Boolean value? <?php class Foo { public function bar() : string { return true; } } $Foo = new Foo(); echo $Foo->b...
asked by 08.08.2018 / 18:42
1
answer

Why use VAR in PHP?

Why use VAR in php if we can declare variables without VAR? We can do this: $teste so why do that? var $teste For example, is it the same thing I do this? class Caneta { var $modelo; var $cor; } And this: clas...
asked by 09.06.2017 / 15:42
6
answers

Upload files (always in different folders)

I would like to know if it is possible (and how could I do) to create an upload system where whenever I upload a file, it goes to a different folder (always), and shows me he begat. Is it possible to do this? Reason : I always generate PDF p...
asked by 31.01.2014 / 11:50
7
answers

How to do a dump of a MySQL database with PHP?

Currently, to export only the structure of a particular database, I use the following: mysqldump -h host -u usuario --no-data --database banco > dump.sql -psenha This generates an SQL file, all solved. However, this is a manual process t...
asked by 05.02.2014 / 06:26
1
answer

PDO connection pooling management

We often see in multithreaded applications that use a connection to a database, the use of a connection polling , in which it stores a pool of open connections. way to increase performance so that you do not have to open connections at all time...
asked by 28.07.2014 / 19:21
4
answers

Send data to server even if window is closed

I'm using the beforeunload event to try to send an ajax request to the server before the user leaves the page but it does not work very well. Is there a way to send a request that continues to run on the server even though the browser...
asked by 03.05.2017 / 15:21
2
answers

Create a Vertical Label or Input

I need to create a LABEL or an Input so that the typed text is Vertical, as follows: M E U T E X T O Would It Be Possible Anyway? This is required for the printing of banners in this format.     
asked by 19.07.2016 / 18:11
2
answers

POST method does not take FORM value

I'm making a contact form on a website, but the PHP method does not get the value of input in form , I already searched the internet and could not find anyone with the same problem. And email is being sent, the value of the $s...
asked by 31.07.2015 / 13:32
2
answers

How do I know if a class implements an interface?

In PHP, we can implement one (or more) interface in a class. So: interface Authenticable { // métodos } interface Model { // métodos } class Person implements Authenticable, Model { // métodos } In...
asked by 21.10.2016 / 12:39