Questions tagged as 'php'

3
answers

Global variable in all class functions

Normally when I want to pull a variable that is outside the class, I use global $variavel , but I wanted this variable to be accessible in all functions of the class, so I do not need to "pull" all the functions, how?     
asked by 10.03.2015 / 20:26
2
answers

call function php in C #

As by C # in WindowsFormsApplication call a function from a php page and pick up the value from it, eg: page php: function retornar() { $valor = "aa"; return $valor; } In case I would like to call this page through C # and assign a val...
asked by 14.03.2017 / 16:04
2
answers

What does the "?:" operator mean in PHP? [duplicate]

What does the ?: operator mean in PHP? Example: $a = 0; $b = false; $c = 3; echo $a ?: $b ?: $c; Result:    3 What exactly is it doing in the above expression? Is this a ternary? If not, what do you call this operat...
asked by 14.08.2015 / 22:53
3
answers

How to only allow numbers and hyphens with preg_replace?

I'm having a question regarding preg_replace , I'd like to know how I could do to only allow numbers, and hyphens ( - ). My code is as follows: $ola = preg_replace('/[^[:alnum:]_]/', '',$_POST['ola']); How can I do just numbe...
asked by 17.02.2017 / 21:00
2
answers

How to reset all data in a form if the user returns to the page?

I have a form that, after being submitted, displays the result on a second page, type: <form method="post" id="form" action="form.php"> <input name='nome' id='nome'> <input type='submit' value='Enviar'> </form> And n...
asked by 04.03.2017 / 12:40
4
answers

Numeric sequence loop in PHP

Good morning I have the result in MYSQL 01 03 04 06 11 I need a solution that fills in 2 zeros where it loses the numerical sequence up to number 12. Example: 01 00 03 04 00 06 00 00 00 00 11 00     
asked by 03.04.2018 / 14:41
2
answers

MySQLi vs PDO - query execution / functions

Looking at questions here from the stack and the php.net site, I saw that the query / function runs in MySQLi uses if() to check whether it was executed or not, and PDO uses try { ... } cacth() { ... } , example connection to bank ac...
asked by 03.03.2018 / 06:25
2
answers

Expand / collapse table contents by clicking title

I have a table, I want to load the page with its hidden content, and when I click on the title (in the example below waiting ), load the content and click on the title again the content is collected and hidden. How can I do this? <...
asked by 28.03.2018 / 20:39
3
answers

How to check if the email is registered when typing on the form? [duplicate]

I have a registration form, and I would like you to let me know as soon as the email is entered, if it is already in the database. I thought of using a JavaScript function with a PHP code inside that will search if there is email in the Ban...
asked by 16.11.2017 / 21:51
2
answers

What is the equivalent of 'explode' from PHP in Python?

In PHP, if I want to split a multi-part string based on a delimiter, I use explode . How can I do the same in Python?     
asked by 15.06.2018 / 05:33