Eg: Why use a closure for this function:
We could do the same thing without a closure, but why use this class?
public function getTotal($tax)
{
$total = 0.00;
$callback =
function ($quantity, $product) use ($tax, &$tota...
How can I count the columns of a MySQL table using PHP, does anyone know of any commands to do this?
I tried to do this but it did not work:
$sql4 = mysql_query("show fields from ".$tabela) or die('erro na query');
$rows4=mysql_fetch_array(...
I would like to know how to compare the contents of a string in PHP.
I'm looking for a word on a line, but I do not know what position it is in.
$ch_atend
if($linha == "idle") { $ch_atend = $ch_atend++; };
This code is within a While and...
PHP 5.5 has implemented a new feature, which consists of getting the class name through the keyword class :
Example:
namespace testando;
class Teste{}
echo Teste::class; // testando\Teste;
This works correctly, as expected.
Now...
I'm doing a Framework, using namespaces. But in the PDO connection file a strange error is happening to me:
Fatal error: Uncaught exception 'PDOException' with message 'could not
find driver 'in C: \ xampp \ htdocs \ Application \ Core \...
I'm developing a hashtags system in PHP , and my question is:
How can I make a% of% of posts from content?
For example, the content saved in the database is:
Hi, how are you? #bomdia
In case the SELECT would be somet...
In PHP, to check if a constant exists we use the defined function. As below, for the two cases of constant declaration:
const MY_TEST_1 = 'my test 1';
define('MY_TEST_2', 'my test 2');
var_dump(defined('MY_TEST_1'), defined('MY_TEST_2...
I want to "filter" string to get only the date that is in it, string is in that format:
SSC Napoli v Dnipro - Thursday 05/07/2015 04:05 PM
What I want to get is just 07/05/2015 16:05 , I used explode :
$data...
Next, I have a page that generates content scrambled with dynamic and non-dynamic strings, I need to get a dynamic value between the | tabs, it contains random data / strings that change when loading the page. The variable I want to get h...
I have a javascript file that does ajax requests for my API, but I do not want anyone to find out the link to it, is there any way to block access to this file?
If you do not have some way to release so only the site can access?