Separate code blocks by putting empty lines. :)
And again, per the styleguide - all if/elseif/else statements must be followed by curly braces on the next line:

    if ($line[$i] === "'" && ! $in_dstring)
    {
        $in_string = ! $in_string;
    }
    elseif ($line[$i] === '"' && ! $in_string)
    {
        $in_dstring = ! $in_dstring;
    }