In C you can use function pointers to reference other functions, see an example:
int somar(int a, int b)
{
return a + b;
}
int (*sPtr)(int,int);
int main(void)
{
sPtr = &somar;
int r = sPtr(10, 5);
printf("Soma: %i",...
On our hosting server, I have two projects, where both have a module in our administrative area to manage images.
In the A project, the form is submitted to the server and the $_POST array is received by the server with the image fie...
I am creating a forum system that is divided by sections. Each section contains categories, each category contains topics. Ex:
Administração _
|_Regras da do fórum
|_Sugestões e críticas
Aeromodelismo _...
I do not know much about regex, so I got this rule ready.
$break_title = preg_replace('/(?<=\>)\b\w*\b|^\w*\b/', '<span>$0</span>', $title);
return $break_title;
The problem is that it does not recognize the cedilla, so th...
I have a code that compresses file and directory. The problem is that it compresses the files and directories that are in the root, but the subdirectories they are not compressed, for example
I have these directories:
folder /, folder / fi...
A friendly url of the type:
www.meusite.com.br/controlador/metodo/argumentos
It is handled in my Request class, where it "explodes" the url , separating it into segments, which are $controller , $action and $args...
I was reading about Service Container in Laravel, but I was not able to fully understand the purpose of this feature.
I know that to create new services we have to use some Laravel methods:
App::bind()
or
App::instance()
there are...
I wonder if there is a way to save these two variables.
Here is the code:
<script type="text/javascript">
function opcao()
{
$(document).ready(function()
{
var empresa = $('#Empresa op...
I have the following structure for registering a new MySQL database account (register.php):
<?php
$con = mysqli_connect("meu_host","meu_user","minha_senha","banco");
mysqli_query($con,"INSERT INTO contas VALUES (" + $id + ", " + $pass...
When you run the following code:
function foo(string $text) {
echo $text;
}
foo('bar');
I get the following error:
PHP Catchable fatal error: Argument 1 passed to foo () must be an instance of string, given string, called in / hom...