All Questions
8 questions
3
votes
1
answer
15k
views
Depreciated strlen(): Passing null to parameter #1 ($string) of type string is depreciated
your text
The above warning is displayed in PHP 8.1 after upgrading from PHP 7.4
Any ideas on how this code can be changed for PHP 8.1 compatibility?
private function cleanInput2($strRawText, $...
7
votes
6
answers
14k
views
What if a null character is present in the middle of a string?
I understand that the end of a string is indicated by a null character, but i cannot understand the output of the following code.
#include <stdio.h>
#include <string.h>
int
main(void)
{
...
0
votes
1
answer
737
views
Arduino. The length of NULL
This is not an question, I just want to share a headache I had for a while.
Why I got 1 in:
Serial.println(strlen(NULL))
Because of this macro:
#define NULL ((char *)0)
I was expecting 0, but ...
0
votes
2
answers
818
views
strlen sometimes equal to sizeof for null-terminated strings
I know that strlen counts the number of characters up until (and excluding) the null character '\0' (or 0) and that sizeof gives the amount of space needed to store the string including the null ...
0
votes
5
answers
148
views
How does strlen giving the same output for {'1','1'} and {'1','1','\0'}?
strlen() is terminated by null right? So how come both char c[]={'1','1'} and char d[]={'1','1','\0'} gives the same output 2 when strlen(c) and strlen(d) is used?
0
votes
3
answers
314
views
How to ensure the string is full of spaces for a given length?
I have a bunch of strings that I need to verify if these have all spaces.
I can do strlen(trim(strct.data)) > 0.
But, it's not null terminated, but the length is known.
i.e. if strct.len is 5 ...
4
votes
3
answers
2k
views
How could a PHP value contain a string of zero length not equal to the empty string or null?
I am retrieving some data from an in-house store and in case of failure, I get a very specific response. Calling strlen() on this variable returns the value of zero. It is also not equal to NULL or "...
1
vote
2
answers
10k
views
How to know whether an array is initialized in C
How to know whether an array is initialized in C ? Functions like strlen() are not helping me as I dont want to know whether the array is empty or not.