Questions tagged as 'php'

1
answer

Convert any string to UTF-8 without knowing the original character set

I need a function or class to ensure that data sent from a form ( from anywhere in the world ) goes to the database in UTF-8 encoding. I have tried, $string = iconv(mb_detect_encoding($text), "UTF-8", $text); but it has problems (if th...
asked by 03.04.2017 / 13:23
2
answers

filesize for files larger than 2GB on x86 platforms

I was reading the PHP documentation and noticed this information:    Note: Because PHP's integer type is signed and many platforms use 32bit integers, some filesystem functions may return unexpected results for files which are larger than 2GB...
asked by 11.10.2015 / 00:02
3
answers

Receive external JSON data by PHP

I'm trying to get an external JSON file via PHP. I'm doing it this way: <?php $json_file = file_get_contents( "http://www.moonwalk.com.br/api/VitrineDeProdutos/58e903df295cbc5c4639434d4c35090d"); $json_str = json_decode($json_file, t...
asked by 05.02.2014 / 18:52
1
answer

Fibonacci Sequence

I need to perform an exercise to show the Fibonacci sequence up to the 100th element, I must create a Fibonacci function that should receive the index of the element and the function will calculate the corresponding number of that index. I'm...
asked by 15.12.2015 / 04:01
3
answers

What are the native PHP exceptions?

Where can I check all the exceptions (native) that can be launched by PHP? I searched and found only forms of treatment with try/catch .     
asked by 14.04.2015 / 16:57
4
answers

Return typing in PHP 7. What are the advantages?

I was giving a test in PHP 7 and checked that it now accepts to define which type of data is going to be returned. Here are some tests: Defining the instance to be returned function test_object(): stdClass { return new ArrayObject;...
asked by 21.10.2015 / 17:33
1
answer

Open WhatsApp when you click the icon

Someone knows how to do that by clicking on the WhatsApp icon on a site by smartphone , some function opens the application and already starts a conversation in the number defined in link from the website? Imagine an icon that says "WhatsA...
asked by 27.08.2015 / 02:31
4
answers

What is the difference between "++ $ variable" and "$ variable ++"?

What is the difference between ++$variavel to $variavel++ ? I realize that when I execute a for with both forms, the results are the same. Example 1: for ($i = 0; $i < 3; $i++) echo $i; Prints: 0 1 2 Exampl...
asked by 12.08.2015 / 17:16
1
answer

CakePHP Actions Not Found in Vhost from Wampserver

I'm trying to make my admin actions protected by SSL, including login action. However whenever I try to access one of these actions, I always get the 404 error. For example, when trying to access the login page, Cake redirects to link , with er...
asked by 29.07.2014 / 15:35
1
answer

Laravel 5 and Sql Server

I need a help, I made several attempts to connect Laravel with SQL Server and all without success. However, I was able to run pure php using sqlsrv_connect and Code Igniter. Windows 10 64 bits. Wampserver 2.5 32 bits. PHP version: 5.5.12 (TS,...
asked by 16.11.2015 / 18:58