Questions tagged as 'php'

3
answers

What is the purpose of the "header ()" function?

In my question about HTTP protocol I understand that HTTP requests have a format that is described by the protocol itself. However, in PHP there is a function that sends data to HTTP which is the header() function and I did not quite...
asked by 07.01.2017 / 18:59
3
answers

How to parse a string array into a multidimensional array?

I have the following array: Array ( [0] => MemTotal: 4060964 kB [1] => MemFree: 3630320 kB [2] => MemAvailable: 3789472 kB [3] => Buffers: 93040 kB [4] => SwapCached: 0...
asked by 24.11.2016 / 15:38
4
answers

How to create a list of dates of the year in php, skipping the weekends?

I need to create a list of dates in PHP, where I will list all dates, from the first day of the year to the last. However, in that list, dates for the weekend (Saturday and Sunday) should be skipped. Example: 01/02/2016 => Segunda 02/02/...
asked by 04.02.2016 / 13:27
2
answers

Enable and Disable Save Button

I am developing a Revenue / Expense launch system and this works according to what I initially need.    Processes. Revenue Posting, adds the amount of Revenue to the account table.   Example:   Initial Account Balance = 0.00   Revenue...
asked by 11.10.2016 / 16:55
3
answers

In PHP are all declared variables global?

In C # there is the concept of local variables, see the example below: if (true) { int valor = 10; } else { valor = 5; } Console.Write(valor); The above code will return an error saying that the valor variable does not exist...
asked by 26.12.2016 / 17:13
2
answers

Problems with str_pad function and accent

I'm using the str_pad function to get a string and fill it with 10 0 characters. It's working perfectly, see the example: echo str_pad("dda", 10, "0", STR_PAD_LEFT); It writes 0000000dda . The problem occurs when I...
asked by 12.09.2016 / 22:21
3
answers

Withdraw currency formatting and get only the number in PHP

I store the values of the products in the database as follows: For example: R$ 5.000,00 How do I do in PHP to make this number stay 5000? In other words, "deformat"? Do you have any function that works for any number? Something like t...
asked by 09.08.2015 / 04:39
2
answers

Regular expression start, end

I have two regular expressions: $exp1 = '/^abc.*\_20150430.txt$/' $exp2 = '/^def.*\_20150430.txt$/' It should return true for files started by abc in the first and def in the second. In both expressions the string should end with _20...
asked by 30.04.2015 / 20:49
4
answers

What is the second array_keys parameter for?

I was giving a stir in the sublime text and I came across something I did not expect when I typed the function array_keys array_keys(arg, search_value, strict); I did the test and the second parameter actually works. What is the...
asked by 02.12.2015 / 17:32
3
answers

PHP Error - Empty () Function

I have the following error: Fatal error: Can't use method return value in write context in /home/username/public_html/Administrar/application/controllers/holerites.php on line 29 The following sequence of lines 29 follows: if(empty($this-...
asked by 01.08.2015 / 04:23