Ladies & Gentlemen,

I got this array:

$test = array('id','date_and_time','kw_1','kw_1_point','kw_2','kw_2_point','kw_3','kw_3_point','kw_4','kw_4_point');

Now I want to echo all the values that does not conatin '_point'.
So, how to do that ?

brandonrunyon commented: Iterate over the array and use the string position function to find the desired substring. If it returns false then echo it. +6


But what if I want to search for string that starts with "kw" ?
Or has "
" somewhere ?
And what-about if I want to search for string that has "1" in midst somewhere ?

How does this work for you?

foreach($test as $v){
    if (strpos($v, '_point') !== false) {
        echo $v;

I didn't test it

He wants all the values that don't contain point, so it would be the opposite:

foreach($test as $v){
    if (strpos($v, '_point') === false) {
        echo $v;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.