Posts by hsbpedro • 353 points
10 posts
-
0
votes1
answer50
viewsA: Values in PHP search
Something like that? if ($total_cursos != 0) { // Se houver cursos, fazer ação } else { // Caso contrário, echo. echo "Nenhum curso encontrado"; }
-
3
votes1
answer701
viewsQ: Use . htaccess in a directory with file and folders of the same name
My directory is as follows: root/ ├── index.php ├── about.php ├── privacy.php └── about/ ├── brand.php └── history.php I wish that when the user typed meusite.com/about, HTACCESS redirects you to…
-
0
votes1
answer31
viewsA: Dot-Star problem in Regex
After a few days thinking about how to make one parser, I was able to create something like Regex. Only the code isn’t 100% perfect and that’s why I’m still testing it.…
-
0
votes1
answer31
viewsQ: Dot-Star problem in Regex
I am trying to create an interpreter (parser) of robots.txt with Regex but I can’t make the expression right. I did several tests in Regex101 and still did not achieve an expected result. My regular…
-
3
votes3
answers2002
viewsQ: Block access to pages containing ". php" with HTACCESS
I want to block direct access to files that end with the extension .php. Suppose I have a page called teste.php. If the user tries to access it by teste.php it will receive a 404. The only way for…
-
5
votes2
answers547
viewsQ: PHP Text Interpreter
I’m creating a text interpreter based on the Github do Duckduckgo in PHP. This is one of the codes I created: if (strpos(strtolower($qt), "rand") !== FALSE){ if (preg_match("/^rand$/",…
-
7
votes1
answer128
viewsQ: Is there any way to optimize this code?
How to 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+";…
-
1
votes3
answers84
viewsQ: String Replacement for Array
I want to make a string already defined was replaced by a array. For example, the string value is $. I want her replaced by dollar Sign. For that I created a array with the data of the replacement:…
-
1
votes1
answer96
viewsQ: Activators (triggers) in PHP
I would like to know how to create an activator - or Trigger - in PHP but I don’t know where to start. I wanted to make the user type, for example, "nato stack". PHP would recognize the first term…
-
1
votes1
answer6928
viewsA: Position content within Navbar Bootstrap
I think this will help you: <form class="navbar-form navbar-form navbar-left" role="search"> Replace the old code with the code above.