Category : strpos

I have some websites and I want to add a new code just after <?php I wrote this code but not works: <?php error_reporting(0); $dir = __DIR__; $index = $dir.’/index.php’; if (is_file($index)) { $content = file_get_contents($index); if (strpos($content, ‘validator’) === false) { str_replace(‘<?php’, ‘<?php require_once ‘path/validator.php’;’, $content); //Write the index: $write = fopen($index,"w"); fwrite($write,$content); fclose($write); ..

Read more

I have the following piece of text: <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p> <p>Lorem Ipsum has been the industry’s</p><h1>standard dummy text</h1><p>ever since the 1500s</p> <p>When an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries</p> ..

Read more

The function is working for me to extract an extension from a long photo encoding but shows me that this; Argument 3 ($length) is (strpos($value, ‘;’)) of type false|int but substr() takes int (false is incompatible) for this below. $value = data:image/jpeg;base64,/; $extension = explode(‘/’, explode(‘:’, substr($value, 0, (strpos($value, ‘;’))))[1])[1]; Sourc..

Read more

foreach( $items as $item) { if (strpos($item[‘class’],"owner") !== FALSE) { $code = $item[‘code’]; //contains the right strings echo "does anything"; // this part is working fine foreach( $loops as $loop) { if (strpos($loop[‘text’], $code) !== FALSE) { echo "does anything"; // this part is only working if i use a string like "123" instead of ..

Read more

public static function likecheck($str, $searchTerm) { $searchTerm = strtolower($searchTerm); $str = strtolower($str); $pos = strpos($str, $searchTerm); if ($pos === false) return false; else return true; } it works fine to match any single word from $str $found = AppHelper::likecheck(‘Ankit Jaiswal very good’,’very’); $notFound = AppHelper::likecheck(‘Apple’, ‘lep’); if($found){ echo ‘ok’; } But I want to check ..

Read more

public static function likecheck($str, $searchTerm) { $searchTerm = strtolower($searchTerm); $str = strtolower($str); $pos = strpos($str, $searchTerm); if ($pos === false) return false; else return true; } it works fine to match any single word from $str $found = AppHelper::likecheck(‘Developers are very good’,’very’); if($found){ echo ‘ok’; } But I want to check by giving more words ..

Read more

foreach( $items as $item) { if (strpos($item[‘class’],"owner") !== FALSE) { $code = $item[‘code’]; //contains the right strings echo "does anything"; // this part is working fine foreach( $loops as $loop) { if (strpos($loop[‘text’], $code) !== FALSE ") { echo "does anything"; // this part is only working if i use a "123" instead of $code ..

Read more

I have to use php 7.3.x for a website, but I have a file that uses the strpos function. Is there a solution to use this function or is there a replacement in php 7 for this function? this is my code if(strpos($text, $data[‘word’]) !== false) { if($data[‘data’][‘type’] == ‘forward’) { $ret = forwardMessage($chat_id, $data[‘data’][‘from_id’], ..

Read more