Questions tagged as 'php'

1
answer

How the websocket works in php

I have this doubt, for example, I have a server written in PHP. When a user A connects to that server, the server performs an action that takes 4 seconds for example, if before that time a new user B connects, it will have to wa...
asked by 23.12.2015 / 23:52
2
answers

Convert XML to array in PHP

I'm looking for article names through this link: [http://api.elsevier.com/content/search/index:SCIDIR?query=heart+attack&apiKey=20d0c7953f56925f725afe204869dadb&xml-decode=true&httpAccept=application%2Fxml][1] You are returning...
asked by 20.01.2015 / 16:55
3
answers

Assign type to array in PHP

I know that PHP is a poorly typed language. But is there any alternative way to "type" a array in PHP? Example, I can do this below to force a given data type to be given in a function. function exemplo(Classe $valor){ // meu cód...
asked by 04.02.2015 / 19:54
2
answers

What happens when we run PHP scripts with long tasks?

I am running a PHP script that is responsible for downloading 55'000 images on one server and downloading these files into a folder on another server. It should take according to statistics per minute around 1h40 to complete the task....
asked by 04.11.2014 / 15:13
2
answers

Run parallel process in PHP

I have a Web service that is consumed by some applications. On the Web service server you should use the Amazon API and execute a process whenever a change of record is made via Web service . Initially, I thought about running the Amaz...
asked by 31.03.2015 / 14:52
4
answers

How to do external login authentication?

I need to develop a system to be used by the user. The user will be registered in another system, where we will have the registration, contracted plans and financial control of the same ... The idea is that when the user attempts to login to...
asked by 24.09.2014 / 21:38
2
answers

What is the safest way to identify that the upload file is an image?

I'm making a system where I can receive an image upload. To check on the server if the file type is image, I thought of this code: if (strpos($upload->getClientMimeType(), 'image') !== 0) { throw new UploadException( sprintf...
asked by 20.01.2017 / 13:30
4
answers

How to generate a serial key that contains a prefix in the first 5 characters?

I have a script in PHP that generates a serial key , but I need this script to generate this " serial key " with a default at the beginning, as if it were a prefix. The code I already have is: <?php $chars = array(0,1,2,3,4,5,6,7,8,9,'...
asked by 20.11.2017 / 02:45
3
answers

Merge all values on the same level of the array, on the same level

I have the following array : Array ( [A] => Array ( [0] => 10 [1] => 20 [2] => 30 ) [B] => Array ( [0] => 100 [1] => 200...
asked by 05.05.2018 / 17:54
1
answer

Is there a magic method for calling an attribute as a method in php?

For example, we have the class: class foo { var $bar = 1; } I wanted to know if I can do something if I call it like this: $foo = new foo; $foo->bar();     
asked by 08.09.2016 / 14:35