Can you optimize this code to make it faster?
if (strpos($qt, "blood") !== FALSE){
if (preg_match("/^blood (?<blood>.+)$/", $qt, $match)){
switch ($match['blood']) {
case "a+":
$result = "A+";
$sndline = "Id...
So I was giving a searched, looking for some function of php that verifies if a certain number exists inside a variable. And I found the preg_match ().
code:
$numeros = "1 2 3 4 5 6 7 8 9";
preg_match(1,$numeros);
Error:
...
I have been studying regex for some time and now I have a problem: Capturing all numbers, including decimals, that are not within single quotation marks .
I'm creating a sort of viewer for PHP code to learn how to use regex better. I have...
Considering that I have a path which I want to check with preg_match if it is the desired path, what is the difference between the two following operations?
// Single quoted string
preg_match('/\/path\/to\/folder\//', $path)
//...
How can I validate the texts below?
Letters (including accents) and numbers (without spacing), separated by. or,. ex: 'hello'
Whole numbers and / or tenths. ex: '22' or '2.2'
I've created a function to check if some words exist in an array. I want to do the word search inside brackets "[]".
Example: [as], [dar], [amar] ...
For this, I'm using the preg_match () function to check if any of the words in the array exi...
I am looking for a function that identifies (return true) if there is a MySQL function in a string.
These would be some examples of possible input to function.
<?php
$randomstrings = [
"foo", //String comum
"NOW()", //Função sem pa...
I have a string to simulate:
<li><a title="string" href="http://geting.com/?v=123?t=abc">Opção 1</a></li>
I would like something that takes the parameter ?v= , just it, same as when we get the method $_GET["...
Good afternoon:
I'm picking up the value of calls to a particular PHP function straight from the source code.
What I need is to scan each of the lines of the source code, and if there are one or more altext () function calls, get the argum...
With this code I can block special characters in my input , however I want it to still accept . , - and _ how to proceed?
elseif (!preg_match('/^[a-z A-Z0-9]+$/', $username)) {
echo json_encode(array(
'log...