Category : substr

I am using strlen to get a count of characters from $skuPrefixValue… I am missing something because I am receiving a blank screen (error) when processing. Can anyone spot what I am doing wrong? $skuPrefixValue = "abcdefg"; $str = $skuPrefixValue; if (strlen($str) = 3): $skuPrefix = substr($skuPrefixValue,0,3); elseif strlen($str) = 7: $skuPrefix = substr($skuPrefixValue,0,7); endif; ..

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

I want to ouput only MYID from URL. What I did so far: $url = "https://whatever.expamle.com/display/MYID?out=1234567890?Browser=0?OS=1"; echo substr($url, 0, strpos($url, "?out=")); output: https://whatever.expamle.com/display/MYID $url = preg_replace(‘#^https?://whatever.expamle.com/display/#’, ”, $url); echo $url; ouput: MYID?out=1234567890?Browser=0?OS=1 How can I combine this? Thanks. Sourc..

Read more

Somehow i cant echo restricted post text, using function substr. <div class="card"> <img src="uploads/<?php echo htmlentities($image); ?>" style="max-height:450px;" class="card-img-top img-fluid" /> <div class="card-body"> <h4 class="card-title"> <?php echo htmlentities($postTitle); ?></h4> <small class="text-muted">Posted By <?php echo htmlentities($admin); ?> στις <?php echo htmlentities($dateTime); ?></small> <span style="float:right;" class="badge bg-secondary">20 Comments </span> <hr> <p class="card-text"> <?php if (strlen($postDescription > 50)) ..

Read more

I have a problem with the strpos & substr function, thank you for your help: $temp = "U:hhp|E:[email protected],P:h123"; $find_or = strpos($temp,"|"); $find_and = strpos($temp,","); $find_user = substr($temp,2,$find_or-2); $find_email = substr($temp,$find_or+3,$find_and); $find_passeord = substr($temp,$find_and+3,strlen($temp)); echo("$find_user+$find_email+$find_passeord<br/>"); /************************************/ Why is the output like this ?? [email protected],P:h123 +h123 but i want this: [email protected],h123 Sourc..

Read more